meta data for this page
  •  

UEFI

UEFI multi disc

How to handle redundant boot from multiple discs ?

Added 2 more EFI partitions (3 discs setup):

# Change partition 1 type to EFI on each disc:
 
sgdisk -t 1:EF00 -c1:efi $DISK
 
mkfs.fat -F 32 $DISK-PART
blkid $DISK-PART
mkdir /boot/efi0
 
mkdir /boot/efi1

Add new partitions to fstab:

/etc/fstab
UUID=xxxx-xxxx  /boot/efi        vfat    umask=0077,nofail,noauto      0       1
UUID=D12D-CBBD  /boot/efi0       vfat    umask=0077,nofail,noauto      0       1
UUID=D150-1EE7  /boot/efi1       vfat    umask=0077,nofail,noauto      0       1
grub_update.sh
#!/bin/bash -eu
 
DEVICES=( \
"/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_500GB_Sxxxxxxxxxxxxxx,efi1" \
"/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_500GB_Sxxxxxxxxxxxxxx,efi0" \
"/dev/disk/by-id/nvme-ADATA_LEGEND_710_xxxxxxxxxxxx,efi" \
)
 
for DEVLINE in "${DEVICES[@]}"; do
 
read -r DEV BOOTDIR <<< "$(echo "${DEVLINE}" | tr ',' ' ')"
grub-install --target=x86_64-efi --efi-directory=/boot/"${BOOTDIR}" "${DEV}"
 
done

According to RAID for the EFI System Partition:

/etc/grub.d/90_copy_to_boot_efi2
#!/bin/bash
 
# https://wiki.debian.org/UEFI#RAID_for_the_EFI_System_Partition
set -e
 
# $1 - dest efi mount point
copy_efi_to() {
if mountpoint --quiet --nofollow /boot/efi; then
    mount "$1" || :
    rsync --times --recursive --delete /boot/efi/ "$1"/
    # Being FAT it is even better when not mounted, won't be damaged in case of computer crash or power outage.
    # Ref: https://forums.debian.net/viewtopic.php?p=759692&sid=ff62e9207a064b027f041d2cd0a612a4#p759692
    umount "$1"
fi
}
 
copy_efi_to /boot/efi0
copy_efi_to /boot/efi1
exit 0