How to Upgrade or Switch Linux Distros Without Losing Data

Bertel King Updated 26-05-2020

When you switch Linux distributions, the default course of action is to wipe everything on your computer. The same is true if you perform a clean install of an upgrade to avoid potential complications.


Turns out, it’s actually quite easy to perform clean installs or change Linux distros without losing data. Here’s what to do so that you’re all set up no matter your current situation.

How Does It Work?

What’s the magic that lets you keep all your personal data? Simple: separate partitions.

Whenever you switch Linux distros, you have to tell the installer what partition setup you would like to have on your hard drive. If Linux is the only operating system on the hard drive, you will most likely have one or two partitions. This includes the main partition, usually formatted as ext4, which includes the operating system and all of your data.

Optionally, you can also have an additional partition called the swap partition What Is a Linux Swap Partition? Everything You Need to Know Most Linux installations suggest you include a swap partition. What is a swap partition for? Here's what you need to know. Read More . This is a portion of your hard drive that’s used as RAM overflow space, as well as the location where RAM data is stored during hibernation.

But you have the freedom to create as many partitions as you like, and you can tell the installer which partitions should be used for which folders.


Creating a Separate Home Partition

Partition hard drive on Linux

If you’re tired of wiping data when you change Linux distros, you want to create an additional ext4-formatted partition. The first one should have “/” (the root folder) mounted to it, and the other partition should have “/home” mounted to it. All of your personal data is stored in the “/home” folder, so that means all of your personal data will be stored in the second partition.

Once you’re ready to switch Linux distros or perform an upgrade, you’re free to wipe out the first partition that contains the operating system and your installed applications. However, the second partition that has all of your personal files and preferences can remain untouched.

Next, when you perform the new Linux installation, you can tell the installer to reformat the first partition (to start from scratch), but leave the second partition alone and just mount it to “/home”. Then, all you need to do is make sure that you set up the same username and password as before, and everything should be back to the way it was.


Separating your partitions does not stop you from encrypting your drive 4 Reasons to Encrypt Your Linux Partitions Thinking about encrypting your Linux disk? It's a wise move, but wait until you've considered arguments for and against. Read More , either.

The only thing you would still have to do is reinstall your applications, but you won’t have to reconfigure many of them because their settings were stored along with your other personal files.

Precautions to Take When Switching Linux Distros

One potential downside is that keeping prior settings while switching between distributions may cause incompatibilities. For example, although Fedora and Ubuntu both use GNOME as the default desktop backend, Ubuntu’s implementation is quite different, and settings from Fedora could get messy. Be aware.

Make sure that when you are giving the two partitions space, you give each of them enough room. If your first, root partition is very small, you won’t be able to install very many applications. If the second partition is too small then you won’t have much room to save your personal files. The partition sizes are hard limits.


Create Linux root partition

I’d suggest giving your first partition at least 15 or 20GB of space if you don’t plan on installing a lot of applications.

If you plan on installing many applications or games (which take up substantial amounts of space), then you may want to go with 50GB. Gamers should look at the games they’re interested in installing and add up how much space each one takes up.

If you find that your partition sizes weren’t appropriate for your usage, you can resize them by booting into a Live environment and running a partitioning tool or using the command line Take Control of Linux Disk Partitions with These 10 fdisk Commands While desktop disk management tools are also available for Linux distros (such as the Disk Utility in Ubuntu), using the fdisk command line tool offers more options. Read More .


Already Have Linux Installed?

If you already have a Linux installation in place and have everything (including your Home folder) on the same partition, don’t worry. It only takes a few steps to achieve the setup you need. The steps are as follows:

  1. Download the Live environment ISO of your favorite Linux distribution, and burn it to a CD/DVD or write it to a USB drive.
  2. Boot into your newly-created media. Use a partitioning tool such as GParted to resize your ext4 partition to the size you want it to be.
  3. Use the same tool to create a new ext4 partition in the empty space created by resizing the first partition. Make note of what partition it is. It should look like /dev/sdXY, where X is a letter designating the drive and Y is a number designating the partition. An example is /dev/sda2.
  4. Mount both partitions, and copy over the contents of the home folder to the new partition. Make sure that you’re copying over all of the contents of the home folder, and not the home folder itself. Otherwise, when everything is done, all of your stuff will be in “/home/home/user”, which won’t work.
  5. Now open a terminal and run the command gksudo gedit to open the Gedit text editor. Now use the menus to open the file located at /etc/fstab in the first partition.
  6. Add the following line to the end of the file: /dev/sdXY /home ext4 errors=remount-ro 0 1. Again, make sure to replace /dev/sdXY with the actual designation for the partition.
  7. Save it, and restart. Make sure to remove the Live environment media so that you boot back into your regular installation.

Switch Linux Distros Without Losing Data

The difference won’t be obvious, but your personal data will now be on a separate partition that stays out of the way when switching distros or performing upgrades!

Separating partitions isn’t only for distro hoppers or to reduce hassle when upgrading to a new release. A separate partition can come to the rescue if you download updates that leave your PC in a state where it doesn’t boot. Simply reinstall a version of Linux on the root partition and you’re back up and running without having to back up and restore a bunch of files.

If you’re now feeling more emboldened to try out other versions of Linux or take a few risks, here’s our list of five bleeding-edge Linux distros 5 Linux Operating Systems That Offer Bleeding Edge Updates Ready for an operating system that boasts the latest features? It's time to try one of these bleeding edge Linux distros. Read More . Just make sure to keep regular backups of your personal data, even if it is now on a separate partition.

Related topics: Data Backup, Linux Distro, Linux Tips, Restore Data.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. dragonmouth
    May 27, 2020 at 12:36 pm

    Having a single /Home partition to share between distros is not a good idea. User program configuration files may be distro-specific meaning that conflicts may arise. A better idea is to have a separate /DATA partition which contains Pictures, Music, Documents and leave most of your /Home as part of the "/" partition. A /Data partition is distro agnostic since it contains no configuration files of any kind.

    The following is a tutorial on how to set up a separate /Data partition in Linux Mint:

  2. Alex
    May 3, 2019 at 2:51 pm

    Thanks for the article! I followed the process for putting data on a separate partition for an existing Linux install (Ubuntu).

    A couple things ended up being a bit tricky:
    1. Reducing the size of the main LVM in Ubuntu was not trivial (lots of StackOverflow searching; ended up doing it on the command line with pvreduce)
    2. It's not clear whether one can re-use the EFI partition when installing a different Distro to a new partition.
    3. When copying data over to a new partition I ran into an issue because I had chosen to use ecryptfs on my home directory during my original Ubuntu install. It ended up being much easier to transfer files from inside my original Linux install (as opposed to from the Live Media).
    4. For an existing install, what happens when you mount the new data partition to /home, do the "original" files get wiped?
    5. What does the process look like if you want to use LVM? (I ended up just making regular ext4 partitions)
    6. When copying files over I first had a permissions issue (copied files ended up belonging to `root` instead of my username. I re-copied existing /home using `cp -a /home/." -- note the default * glob doesn't grab dot files.

  3. mklane
    June 25, 2018 at 7:20 pm

    I'm following the "Already have Linux Installed" instructions and got stuck on copying my home folder from my previous partition to the new one I just created. Is there a recommended method for completing this step?

  4. kshitiz
    July 12, 2017 at 7:00 pm


    I need some clarification. In our Red hat Linux Enterprise 5.x (RHL 5.x) environment , we have "Oracle EPM Software" on separate Mount then the "/" root. Our IT team is planning to wipe out the current OS in "/" root mount and install the OS RHL 6.x . Just wanted to check if EPM software needs any installation and configuration after the new OS installation assuming the "/home" folder is resotred in the "/".

    Thanks in advance for your help.

  5. Joe D
    January 3, 2016 at 5:14 am

    Gahdamn. You call this "painless"?

  6. Anonymous
    October 31, 2015 at 5:11 am

    Hey guys, Can I use this method to mirgrate my home folder to another distro which is installed on external hard drive?
    Let me explain my question - I have installed elementary os (based on ubuntu 14.04 on internal hardrive) and I have a home (in the same partition "/") and I would like to move this "home" to another drive that contains Ubuntu 12.04 with /home partition. Can I move? Basicallly, moving home to another distro on another hard disk. I know this question is confusing!

  7. lobos
    April 23, 2015 at 2:44 pm

    One thing I consistently see missing in these tutorials applies more to the power user crowd, is the reminder to backup your crontab before moving on. Cron tabs are stored typically stored in /var/spool/cron, and would get wiped out and need to be re-created. There may be other applications as well that make use of /var for storage of information that a user might want to keep. Just sayin'...

  8. elx
    January 20, 2015 at 8:06 pm

    An important issue not clearly addressed is when should UUID be used to specify location of disk and what to do when the partition being separated is encrypted. Also , pros and cons of NOT using UUID warrant discussion

    May 17, 2014 at 12:32 am

    root partition / can be really small but then you must seize mount points for /usr and others where the programs are really installed.
    / is used as a tree point it can be almost 4mb , and link the rest of the system to it.
    / generally carries kernel and boot on it but they too can be symlinked.

  10. Ziaur Rahman
    April 30, 2014 at 1:43 pm

    Sorry For spell
    Is this feature work all Linux Distributions?

  11. Ziaur Rahman
    April 29, 2014 at 2:25 pm

    Is this feather work all Linux Distributions?

  12. Uncle Geek
    April 28, 2014 at 7:15 pm

    Remember that you are limited to four primary partitions, so creating partitions needs to be planned. However, Linux will boot from a extended partition, if you think ahead, you may be able to set things up the way you want.

    Thunderbird and Firefox have a user profiles whose contents can be copied to a new installation, even from Windows to Linux or the reverse. The Mozilla site has the instructions, which are quite simple.

    • dragonmouth
      April 28, 2014 at 11:26 pm

      I've had 12 distros installed, sharing the same swap and /home partitions. Needless to say the distros were installed into logical partitions.

  13. Neb R
    April 28, 2014 at 7:10 pm

    I have a question - although I don't see any replies to other questions so this may be useless...
    What can I do if I have a paid-for application like ARES Commander? I was given only 5 times to be able to install and use this app. I am using Linux Mint and if I follow the - every 6 months new version - idea, I will soon enough get in the position that I will not be able to install my ARES again. Is there a way around this? Is there a way that I can install it using my previous credentials? The problem is that every time I have to get an online "go ahead" to do it...
    Any suggestions?

  14. Robert B
    April 28, 2014 at 3:59 pm

    Instead of sharing Home partitions wouldn't it be better to have a separate partition and or hard drive that is a data partition that your various Home folders point to? That way you do not run into any problems with different configurations from one distro to the next. For example on the Data partition you could have a music, video, and documents folders that all the data that you create is stored in. Since I dual boot between Windows and Linux I have all of these folders pointing to where I store the same data on my Windows install that way I do not have to worry about the data being synced between OS's, for my email client I have chosen to use Thunderbird mail because it looks and works the same regardless of if it is installed on Windows or Linux. After I have it installed and working on Windows I install it on Linux and the Linux install of Thunderbird mail points to the Windows profile that way all new email I download all goes into the same spot and that is on the Windows install. Windows cannot see and is so stupid that it does not know that Linux exists but Linux can see and even safely read and write to NTFS. I have an external 2TB USB drive that is an NTFS drive that only has videos on it and if I create or download videos when using Linux they still get stored on this NTFS drive this way I have access to them when running Windows.

  15. Richard Palmer
    April 28, 2014 at 3:56 pm

    I'm with hotdiggettydog on this. While the suggested action often works, major changes of software packages between OS versions can cause major problems if one keeps the home directory.

    If you don't have the space to follow hotdiggettydog's advice then think about copying your home folder to an external usb drive. Then you can copy the relevant hidden config files back to your new home directory to save time setting up each application again; look in and hidden folders. This even worked between Windows XP and Linux many years ago before I dropped XP.

    My way around this has been to keep all my valuable files in a separate partition named "Myfiles" for example, while creating a separate relatively small /home directory for each new OS installation. You can define this existing partition during the installation of the new Linux system (BUT DON'T RE-FORMAT IT) to save messing with fstab and mtab.

    • dragonmouth
      April 28, 2014 at 11:36 pm

      I have kept the same /home partition from Mepis 8.0 through the current Mepis 11.9.92, which encompasses at least 4 major versions, with only minor config problems.

      The distro I have had problems with was PCLinuxOS. Almost every time there was some kind of software update, my settings were reset to default. Whenever there was a version change, minor or major, config changes were guaranteed.

  16. dragonmouth
    April 28, 2014 at 12:11 pm

    One can also create multiple "/" partitions, one for each different flavor of Linux, reusing the same swap and /home. Then all one has to do to change distros is to re-boot and pick a new distro from the GRUB menu.

  17. /home/jim
    April 27, 2014 at 4:29 pm

    I like

    Since the new LTS will be released soon going from LM13 to LM 17;

    Before I upgrade is it safest to: using a live disk, rename the old user account, /home/jim to /home/jimold
    Then during the install create the user jim.

    That way I could probably selectively copy over data that I want to keep and continue to use jim as my account.

    Another Question:
    I never found a good way to migrate resident email account data during an upgrade. For example:
    I liked the aggregation capability of Thunderbird, but after backing up the data then bringing it back after an upgrade did not work well for me, I gave up and now just access my different accounts on-line. Is there a better way?

    Signed: /home/jim

  18. Peter E
    April 27, 2014 at 7:58 am

    I've always just used UbuntuOne to constantly sync my personal files within /home.. pics, docs, music, videos etc... IDK what I'm going to do now that its going. I've looked at the alternatives but I cant see a good integrated sync solution.

    • Christopher W
      April 27, 2014 at 10:48 am

      Google's GDrive can be accessed & used through a program called grive. There is no official GDrive client for Linux yet, but this works. Only bad side is you either have to manually sync it or set it up as a cron job.

    • Christopher W
      April 27, 2014 at 10:51 am

      The ONE downside of this is that if you have a /home partition (and your /home partition backed up!) over the course of many upgrades, the configuration settings may not be the same as the programs are upgraded and changed.

      I ran into this problem with Ubuntu when they switched over to Unity. Couldn't figure out the problem for the longest time. Ended up deleting the ~/.config and ~/local folderrs and a few others, and starting anew.

    • zoomer296
      May 2, 2014 at 1:34 am

      Try BitTorrent Sync if you have more than one computer:

      It's easier if you use the unofficial BitTorrent Sync with GUI:

      BitTorrent sync is better than "Cloud" services because there is no central server for the government to peer into.

  19. Peter E
    April 27, 2014 at 7:56 am

    I really like the idea of this. What about all your installed programs though such as the hidden .wine .steam .playonlinux etc etc? what happens to these when using an 'old' home folder in a fresh installation?

  20. hotdiggettydog
    April 27, 2014 at 2:29 am

    l use this method with one additional step that can save you grief.

    Rename your new home folder something else . In other words, choose a different user name during installation. This will create a new home folder and you can link or transfer files/folders from the old home.
    Home stores user and system settings via hidden files. These can really bork a new install.