Dual booting with multiple Linux installs

Ubuntu Version

Ubuntu 26.04 LTS

Desktop Environment (if applicable)

KDE Plasma

Problem Description

This post may be more of a “how to” . I’ve received great help in regards to Can a EFI partition be changed from FAT16 to FAT32? , which is now solved.

Towards the end of the discussion, the focus was on partitions, mounting, grub, efi, and in particular, how to best setup a drive for multiple Linux installations.

So, just opening up the discussion.

You’ve opened this in the Support and Help area where a problem should be outlined for a specific release, but you mention Discussion??

The Lounge however is for Discussions

An exclusive place for general discussion and ideas.

Do you have a specific problem? or should this be moved to the Lounge for discussion purposes?


Addendum: I’ve now moved it, subsequent to inputs from other moderators.

2 Likes

Thanks for shifting it.

1 Like

Just some background. What prompted the posting of this topic was from the last few posts in the thread at Can a EFI partition be changed from FAT16 to FAT32? - #30 by oldfred , especially anything to do with setting up grub, efi side of things, mounting,etc, where the objective is for a dual boot (or multiple) Linux installations.

@oldfred

If booting multiple Linux installs, I like to have a shared daata partition, so all my data is available to all installs. I use ext4 for Linux and NTFS for a dual boot with Windows.

There are several ways to link the data into an install. Some use Link using ~/config/users-dirs.dirs but I prefer to use separate mount & link folders into /home. I do not use snaps so not sure if this works with snaps.

I create /mnt/data, some suggest just putting it in / as /data. Mounts in those locations will not show in /home. The mount in /media or now /run/media will show in /home inside file browser.
I then link the folders in /mnt/data into /home, so in file browser it has all the same default folders plus a few added folders. If not using /mnt/data adjust commands to your location.

First time I had to move data from default folders as like will hide those making them inaccessible, but still having data & using space.

sudo mkdir /mnt/data
sudo chown $USER:$USER /mnt/data
sudo chmod -R a+rwX /mnt/data

Find UUID of data partition

sudo blkid

Edit fstab with your UUID, use ext4 or depending on format, NTFS requires lots of parameters:

sudoedit  /etc/fstab

UUID={your UUID} /mnt/data ext4 relatime 0 2

Add mount from updated fstab or reboot
sudo systemctl daemon-reload

From /home do a link to a folder in /mnt/data, defaults to /home location. If default /home/Music empty or moved.

ln -s /mnt/data/Music

You do this one folder at a time, and may be best the first time, but can do all the folders in /mnt/data in one command.
for i in echo /mnt/data/*;do ln -s $i; done

1 Like

That’s the way I prefer it also, a number of installs each with their own partition, and then a shared data partition. It makes sense, plus how will any testing on an install be thorough, unless the data can be accessed in full.

If my current /etc/fstab has this:

cat /etc/fstab

/etc/fstab: static file system information.

Use ‘blkid’ to print the universally unique identifier for a device; this may

be used with UUID= as a more robust way to name devices that works even if

disks are added and removed. See fstab(5).

UUID=F8A8-DEF0 /boot/efi vfat defaults 0 2
UUID=9a3647c0-edf1-40a0-9060-8a94ed11e977 / ext4 discard 0 1
UUID=4b32ab29-dbf3-4e3f-b663-d7b8a7b3aa53 /home ext4 discard 0 2
/swapfile swap swap defaults 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

I’m not understanding the need to setup a mount and a link ? It seems redundant ??

I see there is no recursive option for ln so I assume it links all sub folders.

I do not recommend FAT32/vfat for data, except for very small partitions like the ESP or very small flash drives used with camera or Windows.
FAT32 has file size limits, 4 GB max and no journal to make repairs a bit easier. Years ago, until I learned about the file size limit, I was backing up system as image and wondered why it was always 4GB even though I thought I had more data.

The ln command is one top level folder in the data partition. Then all the sub-folders are included.
You have to use the one line script to link all top level folders. Once linked, the folders in /home look just like the default but have a l (el for link) as first letter in permissions.

2 Likes

I only use EXT4 for data on *nix systems .

I get the ln’ command, but I was questioning the need for it. If fstab` takes care of any mounts, and especially a mount to the data (mount point /home), then is there a need for any linking, symbolic or permanent ??

If mounting a data partition in /home you do not need the link. But then have to drill down to see folders.
File browsers show mounts in /media, now /run/media by default. I rename any partitions I only use occasionally to use label as mount, not default UUID. If mounted in / or /mnt/data, mount will not show in file browser and you need the links to have folders in the data partition in /home.

A present, I use Dolphin for file/folder management, and have various ‘places’ setup as shortcuts from Dolphin. With a multi install setup, won’t that type of file access be the same ? Meaning, whether I boot into Ubuntu or Kubuntu, the “data’“ mount will be the same.

Yes, I have noticed that in Dolphin. The mount label names show, but those partitons aren’t actually mounted until I access them from the Dolphin ‘place’ sidebar. The same with the internal parttions, they have a red icon until I access, and they won’t appear in a mount until I do.

I guess your shortcuts can be an alternative to links.

I prefer the mount where not normally seen in file browser & links. I can script that so when I run script in new install I have all my default folders & any I have added.

You would still have to move default folders like Music, Documents, etc to data partition in both installs, or you end up saving data in one install that other cannot easily see. I like everything in the data partition as then it is a bit easier to backup and also copy to my other system. I still backup /home, but keep that in / (root) as it is small with mostly just the hidden (.dot) settings.

Given how the partitions are setup now ..

lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sda
├─sda1 vfat FAT32 F8A8-DEF0 470.9M 2% /boot/efi
├─sda2 ext4 1.0 kubuntu-os 9a3647c0-edf1-40a0-9060-8a94ed11e977 17G 39% /
├─sda3 ext4 1.0 4b32ab29-dbf3-4e3f-b663-d7b8a7b3aa53 626G 21% /home
└─sda4 ext4 1.0 ubuntu-os ace7cad9-775e-4802-8796-4cb0b2b7372a

and “sda3” is the data. At present, I’m using Kubuntu OS, and the /etc/fstab handles the mounting. The partition “sda4” is not referenced or needed.

For a Ubuntu install, the /etc/fstab in sda4 handles the mounting. The data partition is the same as Kubuntu, at sda3. The partition `sda2’ is not refernced or needed.

At grub, the user decides where to boot to. I still don’t see any need for additional work in terms of symbolic links, etc. Am I over simplifying this ?

Do not confuse a data partition and /home. /home has your user settings. And if /home mounted in different installs, you may get conflicts. Each install should have its own /home. I keep /home inside / (root) and have separate data partition.

Sometimes I do copy /home from an older install to a new one, but usually not even when same flavor. I am able to share a data partition with Kubuntu (multiple install/versions or test installs) and Fedora, Debian & Mint test installs. Sharing /home with different distributions whould create major issues, maybe minor issues even if same like different flavors of Ubuntu.

4 Likes

For me, a data partition == /home. Well at least that is how I have used it since using *nix distros. Yet I have never had multiple boots, so your approach may be something I need to consider. :thinking:

I can see what you are describing. Yet ‘Home’ is by default, /home/username with all folders like Documents, Downloads, etc inside of that. At least that is how the Ubuntu and Kubuntu installs setup the file/folder structures.

If `home’ is strictly in the data partition, then what does one call/name ‘home’ that is inside root, which contains the OS partition ? Now when I backup ‘home’ it includes all settings and all data. How would that change in a multi (*nix) boot scenario ?

Hard to imagine life with two ‘homes’. :grin:

You simply create a /home/<user>/Shared folder that holds all shared data across all your installs … that way you do not risk that different app versions clash with configs in ~/.config (or in whatever hidden dir they put their data) …

Often app developers only care for the path forward when it comes to migration to new data or config formats so if you have an older release on disk that you boot into and the app is in a state before a migration you might break the config with unpredictable results for the app …

1 Like

The default install is everything in / (root). That is fine for new users and many others.
Bit more advanced is a separate /home partition.
Then more advanced is separating /home into /home & data or all the folders you see in /home. Then since /home only has your mostly hidden system settings & is relatively small, it can still be in /home folder in /.

You not have to have separate data partition with one install, but it has many advantages with multiple installs as then you can have all data in all installs. You do not share /home as settings may be different in each install, especially if different distributions. But even Ubuntu and Kubuntu may have different settings and overlapt then causes issues. Or even change from one LTS to next LTS may need some different settings in /home.

3 Likes

Arr, yes thanks, that has explained it for me. The “data” I use now includes Kubuntu config settings ( in ~/.config, ~/.local, ~/.var, ~/claws-mail, etc,etc) , so with the current folder structure, I could , in the event of another OS install, overwrite the Kubuntu settings.

It is convenient to have the structure as is, with a single OS/boot, but I would need to separate those config settings from the data, in the event of a dual boot.

Thanks yes, the “fog” of a decade or so on only one *nix OS in the one partition is finally starting to lift.

Definitely if I did do a Ubuntu install, there would need to be ‘work’ done in setting up the folder structure to cater for it.

Back in post #4 I have setting up a new data partition. That works if new install with no current data in /home folders. If data in /home folders you must copy everything first. Like mv or copy & delete every in Documents, Music, Videos, Pictures, etc. And you can create additional folders. Several of my folders, note l as first permission meaning linked.

lrwxrwxrwx  1 fred fred       19 Apr 23  2024 Documents -> /mnt/data/Documents/
lrwxrwxrwx  1 fred fred       19 Apr 23  2024 Downloads -> /mnt/data/Downloads/