12 July 2019
This describes a solution to a very specific problem that hopefully may be of use to someone in the future (and probably to us when we forget what we did).
We installed an Ubuntu 18.04 server using the alternative installer and configured it as a RAID1 system.
The issue here is that the partitions were set up as
ext4 boot partitions not as EFI and the installer happily went away and selected
one of them to be mounted as
/boot. This meant that the kernel and grub information only existed on that one partition with an MBR
that is tied to it; if this disk happens to fail then the system will no longer boot.
What we actually wanted was a cloned EFI partition at the beginning of both disks and then
/boot left alone on the root filesystem
meaning that it exists on both disks as part of the mirrored RAID. The machine was already fully set up before we noticed and so to avoid
having to reinstall everything we figured out a process to convert it to UEFI.
WARNING: The following is dangerous and you could easily break your system so please ensure that you’ve backed up before you start
Install the grub EFI bits and bobs.
Unmount boot and mount to a temporary location.
Copy grub and kernel files to
/boot and create a mountpoint for the EFI partition.
/etc/fstab and remove the
/boot mountpoint. Force a grub update so that the system is still able to boot although
we’d probably recommend that you don’t attempt a reboot right now.
Convert the boot partitions on both disks to EFI. The following example is for when the disk has a DOS partition table, if GPT is in use then you will need a different type identifier for EFI.
Repeat the above for
/dev/sdb and then format the two EFI partitions to vfat.
Inform the kernel of the partition modifications and then retrieve the UUID of
Since the EFI disk is going to be cloned they will both have the same UUID and it therefore doesn’t
matter which is selected for boot. If
sda is removed then
/dev/sdb1 will be mounted to
Add the mountpoint to fstab using the UUID retrieved in the previous step.
Mount the EFI partition, force grub to install the EFI related bits and then update grub.
Ignore the failure since there should now be files in
At this point the system should boot as UEFI although the MBR still exists. You can test if it works by disabling legacy boot in your BIOS settings.
When booted successfully via UEFI there should be files present in
efibootmgr command should return valid information.
The final step is to clone
Take care when using
dd since it’s very easy to accidentally wipe out a partition or even entire disks!