大网数据广告活动
服务器运维问答

How should the EFI System partition be made redundant without using hardware RAID?

· 52CE 我爱测

What is BCP for making the EFI System partition redundant without using hardware RAID? If I create 3x EFI System partitions on different devices and then backup any changes made to the primary (mounted at /boot/efi ) to the backu…

问题原文

原帖链接 · Neil Stockbridge · CC BY-SA 4.0

What is BCP for making the EFI System partition redundant without using hardware RAID?

If I create 3x EFI System partitions on different devices and then backup any changes made to the primary (mounted at /boot/efi) to the backup devices (mounted at /boot/efi-[bc]):

  • Will the system still boot if the primary device fails, i.e. will it select one of the backup EFI system partitions?
  • Will the system select an EFI System partition deterministically when it boots, i.e. must changes to the primary be replicated on the backups before the next reboot?

Is there a better approach such that the system will still boot if the primary device fails?

已采纳解答

原帖链接 · Nikita Kipriyanov · CC BY-SA 4.0

  1. UEFI specification lacks any knowledge about software RAID. It is known deficiency.

I'd speculate probably it's because it was largely influenced by Microsoft guys who weren't able to create a reliable software RAID array in Windows, and they don't know it is possible to make array out of partitions with simple superblock without special internal structure (Windows only can build arrays out of discs converted to "dynamic" logical disk manager or storage spaces format).

  1. You can make several ESPs on different devices and sync them manually.

For example, if you install Proxmox VE on ZFS "software RAID", it'll create several ESPs, and install special "hook" which runs after kernel, bootloader and other boot-related stuff updates, and that hook makes sure all ESPs are kept in sync.

You can also add a Grub hook to install it on both ESPs, as outlined in this answer:

Create the file /etc/grub.d/90_copy_to_boot_efi2 with the following contents and make it executable:

#!/bin/sh
set -e

if mountpoint -q /boot/efi && mountpoint -q /boot/efi2 ; then
        rsync -t --recursive --delete /boot/efi/ /boot/efi2/
fi
exit 0

Then, whenever you or system runs update-grub it will run this script. Also notice this script is somewhat dangerous when disaster occurs; if primary device containing /boot/efi failed and being replaced this script will erase valid contents from /boot/efi2. So in that case you need to disable it (remove executable bit), or check the source condition in the hook before running rsync.

  1. For the backup ESP to take over if the primary device fails, you should set up UEFI boot entries for all your ESPs. In Linux it's done like this:
efibootmgr -c -d /dev/sdb -l \\EFI\\DEBIAN\\GRUBX64.EFI -L debian-sdb
efibootmgr -c -d /dev/sdc -l \\EFI\\DEBIAN\\GRUBX64.EFI -L debian-sdc
efibootmgr -c -d /dev/sdd -l \\EFI\\DEBIAN\\GRUBX64.EFI -L debian-sdd
efibootmgr -c -d /dev/sda -l \\EFI\\DEBIAN\\GRUBX64.EFI -L debian-sda

This is the real example from one of my managed systems. It assumes ESPs are first partitions of each disk. This should be done after you synced contents of your ESPs. efibootmgr -v will confirm that all boot entries that you create like this use different devices.

See also: https://askubuntu.com/questions/66637/can-the-efi-system-partition-be-raided

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-05-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。