Bug 262770 - bsdinstall with EFI system partitions on multiple disks: only one ESP gains attention
Summary: bsdinstall with EFI system partitions on multiple disks: only one ESP gains a...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-sysinstall (Nobody)
URL:
Keywords: install, needs-patch, uefi
: 262771 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-03-25 00:56 UTC by lidapeng
Modified: 2025-01-12 21:37 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lidapeng 2022-03-25 00:56:26 UTC
When installing freebsd13, ZFS (auto) by default, and the two hard disks are used as mirrors. After I finished, I had a whim. I unplugged the SATA cable of the first hard disk, and the system couldn't start. 
Boot the system from usb stick, it was found that the EFI partition in the second hard disk was not formatted. Of course, there was no EFI file in it. 

Plug in the first hard disk, start the system,use "dd" to write the EFI partition to the partition corresponding to the second hard disk, shut down, unplug the first hard disk, and start the system successfully.

I think the "mirror" is  selected during the installation process should be a complete MIRROR of the two hard disks, but in fact, only the zpool is mirrored, but the EFI partition does not.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2022-03-25 00:58:28 UTC
*** Bug 262771 has been marked as a duplicate of this bug. ***
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-03-28 17:19:39 UTC
See also: bug 255318. 

(There might be something more specific, but I don't have a link handy.)
Comment 3 Graham Perrin 2024-12-20 05:47:41 UTC
<https://redmine.pfsense.org/issues/15084> was resolved in October, can the fix there help with FreeBSD? 

> Bug #15084: Upgrading an EFI system installed to ZFS mirror 
> does not upgrade EFI loader on additional disks - pfSense - pfSense bugtracker
Comment 4 Graham Perrin 2024-12-20 05:49:03 UTC
Please ignore the second link in the previous comment. It's a pfSense reference misinterpreted as a FreeBSD reference.
Comment 5 ctineo 2025-01-12 21:37:56 UTC
Installed FreeBSD14.2p0 today (2025.01.12) on a machine in UEFI only mode (no dual or BIOS boot option). And only one of the 2 disk zfs mirror (ada0) has the necessary 'stuff' in the EFI partition to boot if one of the two drives is gone.

tried: dd if=/dev/ada0p1 of=/dev/ada1p1 bs64k

but booting on ada1 with ada0 disconnected resulted in an aborted boot

Before this bug is fixed (hopefully) and the installer does the right thing and makes all disks in a mirror bootable, is there a work-around? What can I do to my other disk to make the system boot if the other disk in the mirror disappears?

for reference, here's the result of gpart show

root@ABCH040:~ # gpart show ada0 ada1
=>       40  125045344  ada0  GPT  (60G)
         40     532480     1  efi  (260M)
     532520       2008        - free -  (1.0M)
     534528  124510208     2  freebsd-zfs  (59G)
  125044736        648        - free -  (324K)

=>       40  125045344  ada1  GPT  (60G)
         40     532480     1  efi  (260M)
     532520       2008        - free -  (1.0M)
     534528  124510208     2  freebsd-zfs  (59G)
  125044736        648        - free -  (324K)