Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What is the best way to share the same /home directories between different linux distribution?

I mean, I want to have both, say, Fedora and Arch, and I want to find my files at home no matter which linux distro I boot into. But if I mount the same partition for /home then I may mess up the configurations saved inside /home directory.

So what can I do?

share|improve this question
add comment

6 Answers 6

up vote 24 down vote accepted

It certainly is possible to share a home folder (or partition) over different linux distributions.

But take the following notes:

  • UID and GID must be the same on each distributions for the certain user(s).
  • (as already pointed out) different configuration files for the same programs could result in unexpected behavior.
  • If you install all distributions onto the same boot folder, make sure that the bootloader handles the different distributions correctly.

I have a working (virtual) setup:

/dev/sda (40GB)
 +-/dev/sda1   /boot (100MB, ext2)
 +-/dev/sda3   swap  (2GB)
 +-/dev/sda4   /home (20GB, ext4)
 +---/dev/sda5  /root (Ubuntu 10.04, 5GB, ext4)
 +---/dev/sda6  /root (Fedora 14, 5GB, ext4)
 +---/dev/sda7  /root (openSUSE 11.3, 5GB, ext4)
 +---/dev/sda8  /root (ArchLinux 2010.05, 5GB, ext4)

Ubuntu and Fedora both run Gnome 2.30, openSUSE has KDE4 and ArchLinux LXDE. All distributions have their necessary boot files on one partition. Switching between the distributions provides a persistent user configuration like intended.

The other possibility would be a lightweight home folder (doesn't have to be a whole partition) for each of the distributions, only providing the necessary configuration files (.gnome2, .kde4, .compiz, .themes, etc.) and a shared data partition with the "heavy" stuff (documents, pictures, videos, music, etc.). Symbolic links in each of the distributions own home folder would then point to the shared partition.

Afterwards, this can be expanded at will to include other stuff as well.
Example: You have eclipse IDE installed on all distributions and want the same configuration and source files available everywhere. You can create symbolic links on each distributions home folder to the shared one to achieve this.

This would be Ubuntu:

$ ls -l /home/user
.eclipse -> /mnt/shared/.eclipse
.gnome2
Documents -> /mnt/shared/Documents
workspace -> /mnt/shared/workspace
...

And openSUSE:

$ ls -l /home/user
.eclipse -> /mnt/shared/.eclipse
.kde4
Documents -> /mnt/shared/Documents
workspace -> /mnt/shared/workspace
...

And so on..

If you're not sure about interfering configuration files, try the second, safer way and find out which home components can be shared easily between the installed distributions.

share|improve this answer
    
Good answer. I would suggest that you, and anyone else trying something similar, take a look at LVM. –  jmtd Jan 25 '11 at 11:57
    
Creating the setup with LVM would make it a lot more flexible and scalable. Using primary/logical partitions works fine for a static setup. Depends on the use case and the available time to implement a solution. –  wag Jan 25 '11 at 12:31
    
I use the light weight home and another partition for the heavy stuff with symbolic links. Works great, and you can add some configuration for common programs such as firefox in the shared "heavy stuff" partition and replace the files with symlinks. –  Fernando Briano Jan 25 '11 at 19:36
    
Great answer. Very helpful. –  boehj Apr 30 '11 at 6:41
    
I am planning on doing something like this with my home computer, since the last update from Ubuntu has left it quite buggy. I tested the situation out on a virtual first, and the same /home folder does cause a lot of issues, especially with desktop managers, because of permissions on that partition. I think the separate /home's with sym links will be what I end up doing for my PC. I'm gonna use: CentOS, Ubuntu, Debian, openSUSE, possibly Fedora all OS files on LVM, a primary partition for a main /boot and extended partitions for all the other OS /boot files. Since they wont work in LVM –  CenterOrbit Nov 9 '11 at 17:58
add comment

I would not recommend sharing your /home between radically different distributions. Two versions of the same program reading and writing the same config files could result in problems, e.g. if the newer version writes something that the older version does not understand.

If you don't mind the paths being different, save your files in the /home for one distro and mount that /home at another location on the other distro (such as /home/<user>/fedora). Then, /home/<user>/foo/bar can be accessed via /home/<user>/fedora/foo/bar on arch, for example.

If you want the paths to be the same, save most of your files to a third, distinct partition, and mount it in the same place within both distributions e.g. /home/<user>/stuff.

share|improve this answer
1  
I have a setup somewhat like this, but with a ~/Docs/ folder. That is where all "my own data" is, outside of this is other program data (specific to a machine or not). Key config files are regularly backed up from ~/ to ~/Docs/configfiles/ –  kasterma Jan 24 '11 at 16:05
add comment

You can share home directories between distributions, even between different unix variants. People with home directories shared via NFS on a heterogeneous network do it all the time.

You may run into trouble if you run different versions of some programs on different systems sharing the same home directories. Troublesome programs are typically the ones with the fanciest GUIs, such as Gnome. For example Firefox will happily upgrade your profile to a newer version but might not let you load that profile again in an earlier version.

share|improve this answer
add comment

You can use symlinks

ln -s /mnt/mydisk/mydocuments /home/user4123/mydocuments

On each distro once. Now each distro has it's own configuration files

share|improve this answer
add comment

You can set the default Documents folder on a different location or partition and the same for other folders, like the Desktop folder, the Download folder and so forth.

Each application has it's own way of using the default paths, so the first time will be a long job...

Some examples

KDE http://docs.kde.org/stable/en/kdebase-workspace/kcontrol/paths/index.html

GNOME http://ubuntuforums.org/showthread.php?t=631711

If you don't find instruction on how to change defaults for some software you can try it ask here again.

Then there is the hard but intelligent way, that is to setup different distribution on the same PC sharing the same kernel.

I advise you (all) for the sake of the curiosity, to take a look at this article:

http://teddziuba.com/2011/01/multiple-concurrent-linux-distros.html

share|improve this answer
add comment

I'd recommend using symlinks for all the common configuration files you find yourself missing from one to the other. Create a new directory in a place accessible to both distros, move the files and symlink from there.

Not only does this control exactly what gets shared, but it makes it very easy to move your preferences to other machines, to put them under version control if you need and to back them up. There are even tools to help you do these things based on the assumption you are working this way (see, for example, homesick).

As far as setting common directories for things such as documents, videos, music etc, there is a standard for this in the form of XDG user dirs, which configures things like desktop, music, images, videos, etc. ( http://freedesktop.org/wiki/Software/xdg-user-dirs). The directories can be outside your home dir, or you can symlink as you like and set the dirs to point at the symlinks. I know Gnome works with these and assume KDE does too.

I did try using the entire same home dir in the past, and different versions of applications quickly caused problems.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.