67

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?

1
  • 3
    I am sharing my home folder between 3 linux distros. Here is one important issue with this that i have realised is probably inevitable. While it can be argued that accessing the same files with different versions of an application should not normally cause any data loss, it seems totally natural that various caches and search indices would need to be rebuilt each time you launch a different (major or minor) version of an application. It looks like i am experiencing this with GNOME desktop search index.
    – Alexey
    Commented Nov 12, 2016 at 21:54

8 Answers 8

48

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.

5
  • 1
    Good answer. I would suggest that you, and anyone else trying something similar, take a look at LVM.
    – jmtd
    Commented Jan 25, 2011 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
    Commented Jan 25, 2011 at 12:31
  • 1
    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. Commented Jan 25, 2011 at 19:36
  • 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 Commented Nov 9, 2011 at 17:58
  • I don't see how could a fully shared /home work unless you'll use the same DEs and programs (and possibly, their versions) on the sharing distros. However, the latter would be unfeasible, as would entail constant "mirror-(de)installing" of programs on all sharing distros (note that a program might not be even available on all distros)
    – jaam
    Commented May 8 at 0:22
12

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.

2
  • 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
    Commented Jan 24, 2011 at 16:05
  • Let each user have it's local stuff. I guess that handling those differences is harder than just share the "common" (Music, Downloads, Codding, Docs, Etc) folders and not dotfiles or other like /usr or /opt. That way you can backup your data from the folder that you use everyday in all of your boxes.
    – m3nda
    Commented Apr 12, 2017 at 19:42
10

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

3
  • this works for me! Commented Apr 19, 2015 at 15:13
  • @MartinDelille Can i ask you for problems since you commented 1 year ago?. Still happy to mix up all files? Wich distros.
    – m3nda
    Commented Apr 12, 2017 at 19:44
  • It was for Ubuntu/ElementaryOS but I don't use it anymore. Commented Apr 26, 2017 at 12:54
6

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.

5

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.

3

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

0

Were I work, the same home is mounted for many remote machines going from the oldest Solaris to the newest debian... many of them having non-standard alternative install dirs.

I came here to get tips, about how to properly set the default shell when it is not installed at the same place on every machine. But in fact, I can give some :

I use tons of conditional configurations, everything is split in folders, named according the the hostname. And in the .profile and the .zshrc I use the $(hostname) variable to load the appropriate settings crafted for each.

This is the cleanest way I could do it...

0

Newbie, but I think that if you use different usernames for each distro, you should be fine. Wouldn't using different usernames for each distro separate the config files?

Reusing the same home settings on a completely new and possibly different upgrade could possilby cause some issues according to what I have read.

Apparently only ~ 5% share home directories per: https://distrowatch.com/polls.php?poll=245

1
  • I know this is old, but config files are usually in the home folder as dotfiles. E.g. the startx command reads $HOME/.xinitrc, not some weird $HOME/.xinitrc-$USER or something
    – 0xLogN
    Commented Jun 18, 2021 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .