Partitioning for dual boot of two Linux systems

If you are using MBR, GRUB can call os-prober to scan all partitions for bootable systems. os-prober (and its cousin, linux-boot-prober, which is called by os-prober) will search all known disks and their partitions for bootable systems. For linux systems it will search for partitions that contain ./vmlinuz* and ./initrd*/./initramfs* or partitions containing a directory called /boot and the former files.

grub-mkconfig will attempt to use os-prober if it can find it and will print a grub.cfg including all systems it found.

Personally, I find this to be less work than using UEFI but keep reading.


For UEFI, first of all you definitely can have several EFI partitions. Yet, it is not a good idea to have several EFI partitions in a multiboot system. This SU answer goes into a lot of detail why, mostly because you can have subdirectories inside a single EFI partition and have a different systems in each subdirectory. You simply make a bind mount to a different place of the EFI partition to be the /boot directory on each system.

For example you can create two different loaders, say:

\loader\entries\mint.conf

title    Mint Linux
linux    \mint\vmlinuz
initrd   \mint\initrd.img
options  root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw

\loader\entries\centos.conf

title    CentOS
linux    \centos\vmlinuz-linux
initrd   \centos\initramfs-linux.img
options  root=PARTUUID=14420948-2cea-4de7-b042-40f67c618661 rw

You need the UUID for the bootloader to know which root filesystem to use. Now you can place the kernel and initial ramfs of each install into their own directory on the EFI partition (one in mint and another on centos).

On each system you then make an /etc/fstab with a bind mount to use the right part of the EFI partition as the /boot directory. For example:

<EFI part> /efi vfat defaults 0 0
/efi/EFI/mint /boot none defaults,bind 0 0

and

<EFI part> /efi vfat defaults 0 0
/efi/EFI/centos /boot none defaults,bind 0 0

Each system will now be able to place its kernel in the right place on upgrade, and the boot happens through UEFI.

Links:

  • How many EFI partitions a computer can have?

If you make a separate /boot partition and install Grub to the MBR, you do not need to update Mint's grub every time you switch OSes. I have this exact setup on my laptop with a partition for Mint, a /boot partition, and another partition I use to try out different distros. Whenever I install a new distro, I simply install os-prober and run grub-mkconfig -o /boot/grub/grub.cfg (with the /boot partition mounted, obviously) and it works fine. The only thing you need to be careful of is getting rid of old kernels and initramfs images on the boot partition when you install a new distro.