44

I have an Ubuntu installed in one partition, Debian on the other and now I am planning to install backtrack and SUSE also. Debian mounts a separate partition as its home mount point, whereas Ubuntu contains its own home folder in its file system.

Now, I want my home partition to be shared by all other distros I have currently or might have on the future.

How can I do this?

P.S. I have same username & nicknames on all the distros

6 Answers 6

27

Ubuntus graphical installer does not automatically create a separate partition for /home. That's true. It is recommendable to do so though, and you can do it if you choose to manually partition. But even if you didn't, you can still fix it.

However, there are a few things to consider. First, make sure that all the distros can actually use the filesystem used on the home partition. It's usually not a problem, but better safe than sorry. Second, and this is more important; don't use the same home directory between distros unless you know what you're doing. The distros may have different versions of the installed software, meaning that their settings might not be identical. It should normally not be a problem since the applications should handle different versions properly, but not all do. It is perfectly fine to have a home directory with a different name than your username though, so that's not a problem.

If I'm reading correctly, you should have two partitions for Ubuntu (swap and root) and a few partitions for Debian. Then the first thing you do, is to mount Debians home directory in Ubuntu and make sure it's mounted at boot by adding it to /etc/fstab. There are loads of documentation on how to do this, so I won't go into it.

If you mount Debians home partition on /home, then it will hide Ubuntus /home directory, so mount it somewhere else first, in /mnt, for instance. Now you have to make some decisions. You can try to use the same home directory for all the distros if you want, or you can have a different home directory for each distro. You could for instance make a separate folder in /home for each distro like:

  • /home/ubuntu/username
  • /home/debian/username
  • /home/other_distro/username

I'd say that's the safest solution. I am assuming your home directories are not encrypted. If they are, then that will complicate things although the main procedure would be similar. You should probably be logged out of your main account when you do this, so create a new user, make it admin and login as that user.

You have to configure all the current users on all your distros to use the new location for the home directory. You should also configure the distros to use those paths by default for new users you create.

If you've mounted the home partition on /mnt, you'd then create /home/ubuntu and /home/debian. You then copy /home/username to /mnt/ubuntu/username and move /mnt/username to /mnt/debian/username (for the Debian user).

You now have both Ubuntu and Debians user homes in the same partitions, but in different home directories. If you have configured both Debian and Ubuntu to mount that partition in /home at boot and changed the users to use the new paths for their homes, then everything should be fine. When you intend to install a new distro, you'd first create /home/distroname/ and install as usual, but use the home partition and configure it to use /home/distroname as default location for new user homes. If you do that, make sure not to format it, otherwise you'll loose the data from Debian and Ubuntu :)

If you want to reuse a single home directory, make sure you know what you're doing. You would need to have the same uid for the users across the distros. Otherwise the permissions would be messed up.

Good luck and take backups :)

3
  • Ok, I decided to go as you suggested. Created a ubuntu folder into the home partition, then copied all files from current home directory to this new /homepartion/ubuntu/ next i edited the /etc/fstab to point the new folder as the default /home directory so I wrote /dev/sda10 /home ext4 nodev,nosuid 0 2 at the end. But now the system cannot find the home folder
    – Starx
    Jul 31, 2011 at 15:01
  • Could you please tell me the steps to do what you meant by `If you have configured both Debian and Ubuntu to mount that partition in /home at boot and changed the users to use the new paths for their homes
    – Starx
    Jul 31, 2011 at 15:22
  • "make sure that all the distros can actually use the filesystem used on the home partition" ←How? Feb 25, 2015 at 23:04
16

This is a late answer, but might be useful for others trying to share info between distros.

As mentioned above, there are issues with applications with different versions sharing the same configuration files in /home/user/.

A simple solution that solves part of the problem, i.e. to share most of the data in the home folder, is to symlink folders like /home/user/Documents. My home folder looks like this:

drwxr-xr-x  3 mike mike 4096 May  2 11:48 Desktop/
drwxr-xr-x  2 mike mike 4096 May  1 21:18 Downloads/
lrwxrwxrwx  1 mike mike   34 Apr 27 12:36 Documents -> /mnt/home/mike/Documents/
lrwxrwxrwx  1 mike mike   33 Apr 27 12:40 Pictures -> /mnt/home/mike/Pictures/
lrwxrwxrwx  1 mike mike   32 Apr 27 12:38 Public -> /mnt/home/mike/Public/
lrwxrwxrwx  1 mike mike   31 Apr 27 12:39 Videos -> /mnt/home/mike/Videos/
lrwxrwxrwx  1 mike mike   34 Apr 27 12:40 workspace -> /mnt/home/mike/workspace/

As can be seen above the Desktop and the Download folders are on the local home partition while Documents, Pictures etc. are linked to a shared partition.

Here is how to setup a symlink (in this example for the Documents folder):

$ cd ~
$ mkdir old-folders
$ mv Documents old-folders/
$ ln -s /mnt/home/mike/Documents/ Documents

The above moves the current Documents folder to old-folders and set up a symbolic link to a shared Documents folder. I've used this scheme for a long time and had no issues so far.

You might find issues with the trash can, if so, check this posting: How do I use gnome trash for files in different partition?

2
  • 1
    Yep, easier to maintain sharing common files (no installs, no configs nor dotfiles) than struggle with many files, from 1 to dozens... all life.
    – m3nda
    Apr 12, 2017 at 19:46
  • Are there any benefits for using symlinks rather than mounting the folders to the Documents path ect. ? (A late comment to a late answer)
    – Morten
    May 13, 2020 at 6:06
14

As it is technically possible to share the /home directory from different distributions (see this answer) it is not a good idea to do so.

Application's settings may have different formats from different program versions. If anything is incompatible or goes out of sync by this we would be entirely lost to find the cause. It is not even recommended to do so within different versions of the same distribution (see e.g. here).

Therefore it is recommended to share personal data files from subdirectories of the user's home only (e.g. by creating symlinks to a directory of your choice):

2
  • I am experiencing problems, with using subdirectories, please see my comment at @jo-erlend 's answer
    – Starx
    Jul 31, 2011 at 15:24
  • Please provide me with some steps to use the subdirectories as the home folder.
    – Starx
    Jul 31, 2011 at 15:27
7

Assuming that the goal of sharing your home-partitions is to have equal access to your personal files/documents/data (but NOT to configuration files specific for each distro), I would suggest that you set the system up with one extra partition only for these shared documents (data) and use your home directories only for distro-specific files.

You can then mount (-bind) the folders from your data-partition to your home in each distro and have access to these data as if they were on your home partition. At the same time you avoid any troubles by conflicting settings etc...

That's what I did and this works nearly perfectly. (Although it somehow resetted my fstab upon upgrade from Ubuntu 11.10 to 12.04, so keep in mind to check from time to time (eg. After upgrades) that settings are still correct.)

6

I took the /ect/fstab approach and here are the steps I took.

I created a separate 100+Gb partition to contain all my shared data, within that I created the 7 folders common to most OS's

Documents, Downloads, Music, Pictures, Public, Templates, Videos
  1. To find the UUID of the partition containing shared data folders, execute the following:

    sudo blkid
    
  2. To automatically mount your shared data partition you need to edit /ect/fstab, execute the following: (Substitute gedit with vi or your favourite text editor)

    sudo gedit /etc/fstab
    
  3. Add the partition information to /ect/fstab, (for me it is the following).

    #/dev/sda4
    UUID=2dc891df-86aa-4d2b-a7aa-bc1620ef8024   /media/DATA ext2    defaults,rw,errors=remount-ro   0   0
    
    /media/DATA/mitchbw/Documents/  /home/mitchbw/Documents bind    defaults,noatime,bind   0   0
    /media/DATA/mitchbw/Downloads/  /home/mitchbw/Downloads bind    defaults,noatime,bind   0   0
    /media/DATA/mitchbw/Music/  /home/mitchbw/Music bind    defaults,noatime,bind   0   0
    /media/DATA/mitchbw/Pictures/   /home/mitchbw/Pictures  bind    defaults,noatime,bind   0   0
    /media/DATA/mitchbw/Public/ /home/mitchbw/Public    bind    defaults,noatime,bind   0   0
    /media/DATA/mitchbw/Templates/  /home/mitchbw/Templates bind    defaults,noatime,bind   0   0
    /media/DATA/mitchbw/Videos/ /home/mitchbw/Videos    bind    defaults,noatime,bind   0   0
    

NB: note the bind as the file system type and within the options.

Alternatively, you could amend noatime to the mount options (after bind and before 0 0):

noatime,rw,errors=remount-ro,bind

If you add these to the mount options for /, /home and the data folders as this speeds up file access and prolongs the life-span of disks drives by reducing disk I/O

  1. To test your modified fstab, execute:

    sudo mount -a
    

and view the mounted file systems with

    mount

More on noatime and /etc/fstab options can be found here:

https://wiki.archlinux.org/index.php/fstab

http://www.openquery.com.au/blog/hint-day-noatime-relatime-fstab

2
  • 1
    why set noatime,rw,errors=remount-ro,bind? Whats wrong with defaults,noatime,bind ? Apr 9, 2016 at 18:35
  • @KhurshidAlam it is because I am using an SSD for my root ( '/' ) directory. Plus I don't need to know when I last opened a file, so why slow my system down by constantly recording such actions?
    – mitchbw
    Jun 6, 2018 at 16:01
1

Its been 2 days since i started this and after several re installations it starts to feel like its making some progress.

Below there are some pictures of how my configuration looks like and it's still sloppy, however my laptop is running both Kali Linux and Linux Mint Debian Edition where they both are sharing the same swap and home directory.

Next, I plan to (hopefully) configure the fat32 partition in green (sda4) for LUKS encryption to test with the emergency self-destruction feature that I've been hearing about.

Anyhow, these are the steps that I took to what I call two distros and one cup (common unified paths) where the goal is to eventually share several directories such as /boot, /home and swap partition.

I figure that I most likely to use Kali Linux as root user and Linux Mint as regular user.

First, I made a clean new partition (after accidentally deleted my whole system) as shown from my blkid and fdisk -l commands below.

Without going through too much details because different distros behave differently such as Ubuntu, elementary and Zorin (I think) were sensitive and kind enough to pop up a message saying "hey, we noticed that you already have something going on in your MBR (Master Boot Record), if you want we can make your installation experience a little better", or something like that - i'm just paraphrasing here.
Anyhoo, something that I wish I had consider before was the fstab and the post partitioning situation.

I'm not sure about the others and I'm not an expert but my experience was that the fsck error that I got on my 5th boot (1st-install kali, 2nd-install mint, 3rd-boot into kali, 4th-back in mint) and I have no idea why it took that many booting in and out before it decides to give me a heart attack.

However, the abundance of knowledge and wealth of experiences shared over the internet by so many experts helped me get through it in no time and unscratched.

Thanks to them and as a non expert (trust me, im still struggling with alsa) I can only share what I went through to the best of my ability and will try to answer + help you in any way that I can.

To me that is the hardest part - to know what to ask - specific enough that others know how to help. also, included here are some of the references that were put out there selflessly by many kind souls which without them I might still dwell with the crappy Windows 7 and not know what to do with myself.

Best of luck and let me know if there are anything that you need me to elaborate further. 73!

enter image description here

gparted+fstab

1
  • 5
    No paragraphs makes this unreadable =(
    – Diego-MX
    Oct 14, 2015 at 0:11

You must log in to answer this question.

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