Keeping Your Files When Distro Hopping

I currently quad-boot my laptop and each of those OSes occasionally gets replaced. It can be messy to keep track of your documents, music, pictures, etc. when distro-hopping. In the past I’ve tried retaining a separate /home partition. This partially works, but can go bad quickly if you’re running different versions of the same software.  I’ve worked out a slightly different system that I’ve been pretty happy with for the last couple of years.

Using rEFIt to quad boot (without GRUB).

Using rEFIt to quad boot (without GRUB).

The Setup

The first step is to create a separate partition for your media. If your only jumping between Linux distros then you can pick your favorite file system. If you’re looking to share with OSX or Windows you’ll need to compromise with a file system like FAT32 that is supported by these operating systems.

Create a partition for your personal media

Create a partition for your personal media

In the photo above you can see I have set aside space for two Linux distros at the front of my SSD. The remainder I have allocated to my media.

Media Folder

Media Folder

I have moved all of my media files to the media partition and mounted it at /mnt/home with the following entry int /etc/fstab

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt/home ext4 defaults 0 2

The magic sauce

Use mount –bind to mount each of these folders in their standard location under your home folder.

The bind option works much like a symlink, with the distinct difference that it’s not a link. Instead, the same data is accessible in two places within the directory tree. By explicitly linking only the folders you want shared, the remaining configuration files can remain different between OSes eliminating any conflicts.

The /etc/fstab entries look like this

/mnt/home/hp/Documents /home/hp/Documents bind defaults,bind 0 0
/mnt/home/hp/Music     /home/hp/Music     bind defaults,bind 0 0
/mnt/home/hp/Pictures  /home/hp/Pictures  bind defaults,bind 0 0

Bonus Tip

If any of your folders have spaces in their name, use 40 as a substitue in /etc/fstab. For example

/mnt/home/hp/VirtualBox40VMs  /home/hp/VirtualBox40VMs  bind defaults,bind 0 0

8 thoughts on “Keeping Your Files When Distro Hopping

  1. Hello,

    I can’t find any contact info in the site so forgive me for using the comment section. I’m Algen, I work with engineering website EEWeb.com and would love to do an exchange of website links (with your website: http://www.heath-bar.com/blog) and feature you as a site of the day on EEWeb (you can see an example here http://www.eeweb.com/websites/multirotor-usa). Is this of interest to you?

    Hope to hear from you soon.

    Sincerely,

    Algen Dela Cruz
    EEweb.com
    algen@eeweb.com

    • heathbar

      Hi Algen, thanks for your interest in heath-bar.com. I would be honored to have heath-bar.com featured on your site.

  2. I like your post. topic is perfectly according to my choice and thinking.

  3. Why do you mount it with “bind”?

    Isn’t regular mounting sufficient?

    I would just setup a partition for “/home” and add it to “/etc/fstab”.

    • heathbar

      Setting up a separate partition and mounting it to /home is not sufficient. I’ve run into issues in the past. If a piece of software updates the format of their configuration files, it will break in one distro or the other. With the method I’ve outlined in this post, each distro maintains its own set of config files, but you get to share the common stuff like Documents/Music/Pictures/etc.

      • James

        heathbar,

        The downside to this is you DON’T get to keep configs from one OS to the other. Example, my bash.rc file has a lot of custom lines that I almost can’t work without.

        • heathbar

          There are certainly benefits and disadvantages to both methods.

  4. I avoid using the “UUID”, because everytime you grow/shrink the partition the “UUID” changes.

    Happened more then once.

    The label I set changes very rarely.

    That’s why I use “/dev/disk/by-label/LABEL” to address the partition in “/etc/fstab”.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>