Pinterest Stumbleupon Whatsapp
Ads by Google

Do you find yourself switching between Linux distributions frequently? When upgrading, do you favor clean installations over in-place upgrades? Do you hate that you have to back up all your personal data, or else lose it?

What if I told you that this doesn’t have to happen?

It’s actually quite easy to switch between different Linux distributions or perform clean installations and still retain all of your personal data. We’ll show you 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.

homepartition_one_swap2
Whenever you install Linux, you have to tell the installer what partition setup you’d like to have on your hard drive. If Linux is the only operating system on the hard drive, you’ll 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.” All it does is allows a portion of your hard drive to be used as RAM overflow space, as well as the location where RAM data is stored during hibernation.

Ads by Google

homepartition_two2
However, you have the freedom to create as many partitions as you’d like, and you’re also able to tell the installer which partitions should be used for which folders. In order to achieve the effect that we want, we’ll need 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/<user>” folder, so that means all of your personal data will be stored in the second partition.

Once you’re wanting to change Linux distributions 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.

The only thing you’d still have to do is reinstall your applications, but you won’t have to reconfigure them because their settings were stored along with your other personal files. The only downside to this is that keeping the 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, and 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.

I’d suggest you give your first partition 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’re better off with 50+GB. 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 always resize them by booting into a Live environment and running a partitioning tool.

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:

  • homepartition_gparted2Use a partitioning tool such as GParted GParted - The Ultimate In Partitioning Software GParted - The Ultimate In Partitioning Software Read More to resize your ext4 partition to the size you want it to be.
  • 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.
  • 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.

homepartitions_fstab

  • 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.
  • 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.
  • Save it, and restart. Make sure to remove the Live environment media so that you boot back into your regular installation.

Conclusion

The different won’t be obvious, but your personal data will now be on a separate partition which will stay out of the way while switching distros or performing upgrades! I definitely recommend that people try to do this, because the benefits far outweigh the single drawback of restricted space within the partition. However, you’re always able to fire up the Live environment and resize the partitions as needed.

Have you placed your home folder on a separate partition? What tips do you have for readers when they’re doing their own partitioning? Let us know in the comments!

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

    Gahdamn. You call this "painless"?

  2. Mohmmad Ayaz Shaikh
    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!

  3. 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'...

  4. 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

  5. Anon@noserver.com
    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.

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

    Sorry For spell
    Is this feature work all Linux Distributions?

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

    Is this feather work all Linux Distributions?

  8. 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.

  9. 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?
    Thanks.

  10. 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.

  11. 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.

  12. 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.

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

    I like LinuxMint.com

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

    Question:
    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

  14. 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: http://www.bittorrent.com/sync

      It's easier if you use the unofficial BitTorrent Sync with GUI:
      http://www.webupd8.org/2014/03/install-bittorrent-sync-gui-in-ubuntu.html

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

  15. 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?

  16. 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.

Leave a Reply

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