Save 10%Pay yearly on any plan. 6% half-yearly, 3% quarterly. Help centreWhatsAppTelegram TeamsOpen a ticket

How to Reinstall Ubuntu Linux Without Losing Your Files

Before reinstalling Ubuntu, try three repairs. If you must reinstall: back up, make a USB stick, and choose the installer option that keeps your files.

3 min readBy Soumya

Reviewed by the AmazingRDP technical team

Reinstalling Ubuntu Linux

On a Linux VPS, a fresh system is one click in the control panel. See Linux VPS from $6.99

Reinstalling is the last resort that always works, and that is its danger: it is tempting to reach for it when a ten-minute repair would do. This guide starts with the repairs, then walks through a reinstallation that keeps your files, and ends with what is different on a server.

Try these first

If the system still starts, or you can reach a text login with Ctrl + Alt + F3:

sudo dpkg --configure -a
sudo apt -f install
sudo apt update && sudo apt full-upgrade
sudo apt install --reinstall ubuntu-desktop

The first two finish interrupted installations and repair broken dependencies, which is what a failed update usually leaves behind. The last reinstalls the desktop packages without touching your files.

If it does not start at all: hold Shift (or press Esc) at power-on for the boot menu, choose Advanced options, and try an older kernel, or recovery mode with its options dpkg and fsck. A full disk is another common cause of a desktop that will not load: see monitoring disk space in Linux.

Step 1: back up, whatever the installer promises

Copy your home folder to an external drive or another machine before anything else. From a working system:

rsync -a --info=progress2 /home/yourname/ /media/yourname/BACKUP/home/

If the system no longer starts, do it from the USB stick of step 2: choose Try Ubuntu, open the file manager, and copy from the internal disk. Also note the programs you installed and any settings outside your home folder, such as files you changed in /etc. For a complete image of the disk, see cloning with Clonezilla.

Step 2: make an installation USB stick

  1. Download the current LTS version from ubuntu.com.
  2. Write it to a stick of 8 GB or more: with Startup Disk Creator on Ubuntu, or balenaEtcher or Rufus on other systems. The stick is erased.
  3. Start the computer from it: see starting Linux from a USB stick for the key to press.

Step 3: choose the right installer option

Go through language, keyboard and network until the installer asks how to install. What it offers depends on what it finds on the disk.

OptionWhat happens to your files
Reinstall Ubuntu (shown when the same version is found)Home folder kept; the system is replaced; installed programs are restored where possible
Erase disk and install UbuntuEverything on the disk is deleted
Install alongsideA second system is added next to the old one
Manual installation ("Something else")You decide per partition; see below

Read the summary before you confirm. The options look alike and the difference is everything you own.

Keeping /home by hand

If your home folders are on a partition of their own, the manual option keeps them safely:

  1. Select the root partition, set its mount point to /, and tick Format.
  2. Select the home partition, set its mount point to /home, and do not tick Format.
  3. Create the same user name as before, so that the old folder is picked up.

Step 4: after the reinstallation

sudo apt update && sudo apt full-upgrade
sudo ubuntu-drivers install

Then reinstall your programs and copy back anything that was not kept. If old settings were the cause of the trouble, they will be back too: rename the hidden settings folder of the program in question in your home folder to give it a fresh start.

On a server it works differently

  • A VPS is reinstalled from the provider's control panel, not from a USB stick. It takes minutes, and it erases the whole server: there is no "keep my files" option. Copy your data off first.
  • A dedicated server is reinstalled through its own control panel or by support.
  • Before reinstalling a server that is merely unreachable, open its console in the control panel. A firewall rule or a full disk is often all that is wrong.

Our Linux VPS plans have reinstallation in the control panel.

Reinstall or upgrade?

To move to a newer Ubuntu version, you do not need to reinstall: sudo do-release-upgrade upgrades in place. Reinstalling is for a system that is damaged, or when you want to start clean. If you are leaving Ubuntu for something friendlier to a former Windows user, see Zorin OS.

Questions

Can I reinstall Ubuntu without losing data?

Yes, with the installer option "Reinstall Ubuntu" or by keeping a separate /home partition unformatted. Back up first in every case.

How do I repair Ubuntu without reinstalling?

Run sudo dpkg --configure -a, sudo apt -f install and sudo apt full-upgrade, or use recovery mode from the boot menu.

How do I reinstall Ubuntu on a VPS?

Use the reinstall function in the provider's control panel. It erases the whole server, so copy your data off first.

Do I need to reinstall to get a newer Ubuntu version?

No. sudo do-release-upgrade upgrades the installed system.