I am running Ubuntu 14.04 (32bit) and want to upgrade to Ubuntu 16.04 (64bit). I have a separate home partition. Is it possible to share the home partition with both versions of Ubuntu whilst the transition goes through ?
Ubuntu – Single home partition for two separate systems – one 32bit, the other 64bit
dual-boot
Related Solutions
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 :)
Yes, you can. This is what I use at the very moment. The other cool thing is that you can bedup the partition after you have installed many similar OSes (like Ubuntu and Linux Mint) to conserve a lot of hard disk space.
The trick is to rename the default subvolumes: @
and @home
into something unique to the distribution installation, e.g. @
-> @mint
or @trusty
and @home
into @homemint
or @hometrusty
.
This can be done at any moment after the installation of the first system, before the installation of the second. The most error-safe way is to take a snapshot of the subvolumes, for instance like this:
- mount root subvolume of the system btrfs partition (assumed to be /dev/sda3) somewhere, e.g. to /mnt:
sudo mount btrfs /dev/sda3 /mnt
- Optional: list the already existing subvolumes - just check you don't create name conflicts in the following steps:
sudo btrfs subvolume list /mnt
- Clone the main @ subvolume:
sudo btrfs subvolume snapshot /mnt/@ /mnt/@trusty
- Clone the home. I strongly don't recommend sharing the whole home subvolume across different systems. (For shared documents create another subvolume, or even better a separate partition, link it with ~/Documents, ~/Desktop etc. and share that):
sudo btrfs subvolume snapshot /mnt/@home /mnt/@trustyhome
- Edit
/mnt/@trusty/etc/fstab
on the new root @trusty to reflect the change the @home -> @trustyhome subvolume (and @ -> @trusty, but that step is not strictly necessary, because by the time the system reads @trusty/etc/fstab it must have already assumed the correct subvolume for root). - Edit
/boot/grub/grub.cfg
: modify all lines that call the current kernel (they look like this:linux /vmlinuz-3.16.0-50-generic.efi.signed root=UUID=9e571eab-4c88-4913-baa3-8d41d94f73d5 ro recovery nomodeset rootflags=subvol=@
) and change therootflags=subvol=@
intorootflags=subvol=@trusty
, so the kernel knows what to boot. Rather miraculously this setting will be preserved when you doupdate-grub
. - Reboot and do
sudo mount
and verify that the correct new subvolumes are used instead of@
and@home
<- This is step is really important, otherwise you will loose your data
And once you renamed the subvolumes, and made sure that system boots, and made sure that there is no @
and @home
- install the next OS, with one modification: use a separate /boot
partition (800MB should be enough). It helps if your partitions use GPT rather than MBR, which fortunately has became a norm. (To quickly tell if you are using GPT is to see if you boot with UEFI on the motherboard BIOS setup. UEFI works only with partitions set-up in GPT format.
If you don't set up the separate /boot
partition - the system will not boot, but you can fix it if you follow the @HullCityFan852 comment:
If you don't have a separate /boot partition then the reboot in Step 7 will fail and you will be left at the grub rescue prompt. At this prompt, type
set prefix=($root)/@mint/boot/grub
(replace@mint
with the path to your distro's subvolume) and then typeinsmod normal
and finallynormal
to load the Grub menu and boot your distro. Once booted, typesudo update-grub && sudo grub-install
to make the change permanent
At the partitioning dialog, use custom partitioning and install the system on the same partition as the first OS. Just be sure, that you tell the installer not to format that partition!
After the installation you can set up chainloading the grubs, so you can select the grub from one installation as an entry on the other and vice versa (how? see What is the recommended way to chainload separate Ubuntu /boot partition).
By having separate /boot
partitions I don't have to worry about one Linux messing grub for the other Linux during the automated kernel upgrade.
Best Answer
You can not share a single
/home
-partition with two different versions of Ubuntu.Many files and folders are stored in the
home
-directory. One part of this files and folders are your private data, such as in the folders~/Documents
or~/Downloads
. Another part of files and folders are configuration-files (most of them are hidden by default and you will not see them in the file-manager unless you enable the optionshow hidden files
) and here the problem starts. Possibly some of the configuration-files are valid for both versions of Ubuntu, but not all of them.You may easily share your private data by creating links to the old data-folders in the
/home
-directory of the new version.If you just want to install
16.04x64
over14.04
(overwriting) then you can surely use the old /home-partition. You only need to set the mount-point for the partition and untick the formatting-checkbox during install, so your data are not deleted.If you want to use both versions you could use a different user-name to install the new version of Ubuntu. If you use different user-names you could share the
/home-partition
, as both versions would have it's own sub-directory in the/home
-folder, (/home/old_name and /home/new_name).A problem is that it will be difficult to access the data-folders (like
Documents
,Downloads
, etc) in/home/old_name
when you use the new version of Ubuntu with a different user-name, you are not the owner of these files in this case.