45

Recently I installed Ubuntu 12.10 x64 Server Edition on my PC. Unfortunately, I attempted to install a lightweight desktop but due to the fact that I have an old graphics card, the PC does not perform so well. I am thinking of re-installing an Ubuntu version but I do not want to lose the contents in my home folder. Is there any way to do that with a Live CD?

4 Answers4

35

Ever since Hardy (Ubuntu 8.04) you can reinstall Ubuntu without losing data in /home even without a separate /home partition.

See

https://help.ubuntu.com/community/HomeFolder

https://help.ubuntu.com/community/UbuntuReinstallation

Preserving home when reinstalling Ubuntu

Since Hardy, Ubuntu can be reinstalled while preserving home even without separate /home: see UbuntuReinstallation.

Few people know it, but since Hardy it's possible to reinstall Ubuntu without losing the content of the /home folder (which contains program settings, internet bookmarks, emails... and all the documents, music, videos that you have put in it). Even if /home is not on a separate partition

Of course, you should always have a backup of your data.

Panther
  • 104,528
17

If you have a dedicated partition for /home:

  • launch the installer
  • when it comes to the choice of disk and partitions, choose "other" and then, manually select the partition for / and /home; check that the installer will format only the / partition, and not the /home

If you have only one partition:

  • launch the live cd, select "try Ubuntu"; if you have an old pc, you may try xubuntu instead of ubuntu
  • once on the desktop, use the file manager to browse your home directory, display hidden files, select all and copy all on a usb key
  • when the installation is finished, you can copy again the files in your /home before restarting
ttoine
  • 1,200
1

This is an update, 04/2025 (question 1546532)

I have a Ubuntu 24.04-Windows 11 dual-boot setup on a laptop. I started with Gnome with gdm then switched to KDE plasma with sddm.

My Ubuntu Gnome Desktop had quite a few things missing. I suspected the system is corrupted. One example is I couldn't install R with apt. Besides, my Firefox browser didn't work. There are a sleuth of other problems. So I'm thinking about reinstalling Ubuntu and start anew.

Here're the steps:

  1. Download a Linux distro and create a live USB.
  2. Boot up from the live USB to the Linux distro.
  3. Check the size of the partition that currently has Ubuntu on it by sudo fdisk -l. Ignore home and swap partitions. Remember the size of the root partition.
  4. Select to install the new distro.
  5. When asked about "Installation Type", choose "Something else" (or "Manual install" in some distros).
  6. In the partition table, find the Ubuntu root partition. Double check the size and make sure it matches with the root partition.
  7. Delete the partition. Now you have a free space of the same size (or more if you have had free space before the deletion).
  8. Create a new partition from the free space. The type of the partition should be "primary" and mount it as "/".
  9. Check the "Format?" box so the new partition will be wiped out. If you want to keep files, do not check the "Format?" box.
  10. If you want to keep an existing home partition, you need to mount it as home again.
  11. Proceed to create user name and password. If you want to access an existing home partition, make sure you use exactly the same user name and password. Otherwise you will have authorization issues.

That's it. You can dual boot as usual.

Update on 04/26/2025:

I tried the method above and it worked. The only unexpected thing was a warning saying something like "efi partition is missing. If you proceed you won't be able to boot blah blah." I quit the installation and made sure I booted from the UFEI flash drive (some systems show two USB devices, one with UFEI in the name and the other without; choose the one with UFEI). If you are sure you booted from the UFEI flash drive, you should be fine.

As it turned out, Calamares provides an even simpler way to replace the ubuntu (replace here means clean slate reinstallation of a new distro). It is called "Replace Partition". With this option, you don't need to worry about deleting/creating partitions, the efi warnings, or existing home/swap partitions. You simply select the partition where the root of the outgoing Ubuntu is located and proceed with installation. Calamares will take care of the rest.

The whole process is like a breeze! It is truly worry free. Note the partition you choose will be wiped clean by default. This is exactly what I want, because I suspect my old system is corrupted. After the re-installation, everything works, including some packages I couldn't install before.

Happy Ubuntu'ing!

tcollar
  • 17
  • 3
-1

Why reinstall? Just install the (meta)-package that installs the graphical Desk Top Environment (DTE) of your choosing. If you want to reinstall, at least create a separate /home partition. If you really want flexibility use Logic Volume Manager (LVM) so you can easily add, remove and resize partitions (aka "logical volumes" in LVM language). You can also add or remove disks to your logical disk (volume group) without reboot the machine.

But please consider to just install the right DTE first, as you really don't need to reinstall your machine to get a graphical environment. Or even uninstall the DTE you installed, if your don't want it in your machine.

Anders
  • 1,615