Synchronizing bootloader and boot partitions among multiple disks

Hi everyone, a noob Fedora user here.

I want to setup a workstation with mirrored disks, so when I lose one of the drives, the system still boots and has all my data.

I have two identical SSD.
Using installer, I created a BTRFS RAID1 volume of two partitions, one on each SSD.
Also, I manually created /boot and /boot/efi partitions on the second disk, with the same type, size and position like on the first one.

Those two partitions on the second drive are now empty. Also, it lacks a bootloader.
I can just clone this data from the first SSD no problem, but I don’t want to do the same every time there is a new kernel installed.

I use Promox on my servers, an it has this special proxmox-boot-tool, which does exactly that - it synchronizes all registered boot partitions automatically every time the initramfs was updated, no need to do anything manually (I guess it uses an initramfs post-update hook).

Is there anything similar in Fedora?

AFAIK you cannot have either /boot or /boot/efi on raid since the raid drivers would not be loaded until the initramfs image is loaded (which happens after the boot loader in /boot/efi and in /boot are read and used). Uefi bios seems not capable of running on raid.

Everything else should be able to run on raid, but not the file systems that initially are used for booting.

This is not a fedora issue, but a limitation of what the bios can do.

I know. The /boot and /boot/efi partitions I created are not in RAID, they’re just plain standalone partitions. This is the way Proxmox handles it: it just keep those standalone partitions synchronized, so every device in a mirror is bootable.

To keep those partitions in sync would only require a script that is run, possibly by cron, to copy over added or changed files and remove deleted files (which happens with kernel updates) so the copy is up to date.

Booting from the second drive would mean a bit of work since the bios would need to be told to boot from the second drive during boot, and UUIDs for those partitions would be different so the initramfs images and fstab entries may be invalid (as well as the entry in /boot/efi/EFI/fedora/grub.cfg which needs the UUID for the /boot partition to function properly.)

Not impossible, merely requiring a bit of management.

Well, it’s definitely not impossible, at least because Proxmox does it already :slightly_smiling_face:
I just wanted to know if there is a ready to use solution in Fedora, to avoid reinventing the wheel.

I think, instead of cron job, I’ll try to use a post-update hook for initramfs, this should avoid redundant runs and decrease the chance of inconsistency.


Remember that the initramfs and /etc/fstab and /boot/efi/EFI/fedora/grub.cfg all would need to be different for booting from different esp and /boot partitions.

1 Like

I’ve never done what you’re trying to accomplish, I have a strong feeling that this won’t be as difficult as it seems.

At installation time, you’ll have to pick which partitions you want on which disk/device you want to use for the OS being installed. The given OS installation procedures should include making its OS’s UEFI files known to the BIOS; booting from either is something that takes place before any Linux kernel business happens. Afterwards, you’ll be booting from two different drives, each with its own efi and /boot partitions.

You might be able to make this more general, but this seems to me to be a natural default installation case.

Good luck!

All this seems correct, but there is a distinct issue.

  1. The OS would be in the raid containing / and /home
  2. Because of 1 the /etc/fstab would only be able to have the entries for one of the 2 sets of /boot and /boot/efi.
  3. The initramfs for the drive used to boot would need to specifically contain the data for its own /boot and /boot/efi.
  4. the files in /boot and /boot/efi would need to be specialized for booting their own system, but the sticky point would seem to be that they would need to share the raid and that booting from one ssd would work but booting from the second ssd with its own /boot and /boot/efi would need some preboot tweaking to handle the issues with /etc/fstab attempting to mount the wrong file systems and the differing initramfs images.

The initramfs may not be different, but the /etc/fstab certainly would as well as the content of /boot/efi/EFI/fedora/grub.cfg, and the UUIDs for both /boot and /boot/efi