Re: UEFI question

From: Julien Cigar <julien_at_perdition.city>
Date: Wed, 23 Nov 2022 08:17:48 UTC
On Tue, Nov 22, 2022 at 08:01:50PM -0600, Larry Rosenman wrote:
> 
> 
> On 11/22/2022 5:50 pm, Eric Borisch wrote:
> 
> > On Tue, Nov 22, 2022 at 1:50 PM Warner Losh <imp@bsdimp.com> wrote:
> > 
> > On Tue, Nov 22, 2022, 11:42 AM Alan Somers <asomers@freebsd.org> wrote:
> > On Tue, May 31, 2022 at 9:27 AM John Kennedy <warlock@phouka.net> wrote:
> > > 
> > > On Tue, May 31, 2022 at 02:32:21PM +0200, Julien Cigar wrote:
> > > > I have a Dell R340 server on which installed a 13.0-RELEASE and then
> > > > upgraded to 13.1-RELEASE (through freebsd-update). ZFS is used
> > > > (raidz2).
> > > > 
> > > > The system has the following partitions:
> > > > https://gist.github.com/silenius/2defdd5480c5c1bc9ba2ff8940756466
> > > > Some things regarding UEFI are not clear to me:
> > > > - as you can see in the partition list, the installer created an EFI
> > > > partition on all 4 drives, however it looks like only the first
> > > > one has
> > > > has been populated (an mounted):
> > > > https://gist.github.com/silenius/1220c953f905d868c1615fd0e7122bbf
> > > > .. why ?
> > > > - if I understand well if my da0 disk dies the system becomes










> > > >   unbootable
> > > > (https://gist.github.com/silenius/51d202053295270eaaeb2c02316165ee)..
> > > > correct?
> > > > - what's the correct way to fix this? should I newfs_msdos on
> > > > each EFI
> > > >   partition and copy /boot/loader.efi as /EFI/BOOT/BOOTX64.EFI? or
> > > >   should I use efibootmgr?
> > > > 
> > > > Thanks for enlightening me :)
> > > 
> > > I use UEFI to multi-boot a lot myself, but not through efibootmgr (vs
> > > picking it via UEFI/BIOS on boot manually).  I'm multi-booting windows
> > > and FreeBSD, so I'm being (justifiably) paranoid, but not based on
> > > being burnt in recent memory.
> > > 
> > > Depending on how your system works (drives are enumerated at startup),
> > > in theory any of your disks could be da0.  If you've only got a
> > > working
> > > EFI partition on one, that is probably hedging your bets a bit but
> > > yes,
> > > if that drive died, you'd probably be dead.
> > > 
> > > In my dual-disk setups, I'd see an EFI and a freebsd-boot (BIOS)
> > > partition
> > > on both disks, I split my total swap between the two (not mirrored),
> > > and
> > > did ZFS "raiding" (mirroring-ish, usually) across the freebsd-zfs
> > > partitions.
> > > 
> > > In my case, using the UEFI/BIOS from the motherboard, I could manually
> > > pick a disk to boot from which let me vet UEFI or ZFS bootblock
> > > changes
> > > for sanity before committing to both.  But yes, I'd upgrade them
> > > both to
> > > the same thing once I was sure it would work.
> > 
> > I just noticed the same problem.  For mirrored installs, the
> > 13.1-RELEASE installer only formats the efi partition on one hard
> > disk.  Shouldn't it do both?
> > 
> > We go back and forth on this question.... I think we should, but others
> > got grumpy when I suggested it. Maybe just all the drives in the zpool
> > used for the BE?
> > 
> > Warner
> 
> Just a "yes, please." If you're installing zfs root on a mirror of disks,
> POLA suggests the required boot bits are on both disks, too.
> 
> Thanks,
>   - Eric
> 
> > 
> 
> This is my common setup for every FreeBSD box I build:
> 
> ❯ gpart show
> =>        40  3905945520  mfid0  GPT  (1.8T)
>           40      532480      1  efi  (260M)
>       532520    16779224      3  freebsd-swap  (8.0G)
>     17311744  3888633816      4  freebsd-zfs  (1.8T)
> 
> =>        40  3905945520  mfid1  GPT  (1.8T)
>           40      532480      1  efi  (260M)
>       532520    16779224      3  freebsd-swap  (8.0G)
>     17311744  3888633816      4  freebsd-zfs  (1.8T)
> 
> =>        40  5859442608  mfid2  GPT  (2.7T)
>           40      532480      1  efi  (260M)
>       532520    16779224      3  freebsd-swap  (8.0G)
>     17311744  5842130904      4  freebsd-zfs  (2.7T)
> 
> =>        40  5859442608  mfid3  GPT  (2.7T)
>           40      532480      1  efi  (260M)
>       532520    16779224      3  freebsd-swap  (8.0G)
>     17311744  5842130904      4  freebsd-zfs  (2.7T)
> 
> =>        40  3905945520  mfid4  GPT  (1.8T)
>           40      532480      1  efi  (260M)
>       532520    16779224      3  freebsd-swap  (8.0G)
>     17311744  3888633816      4  freebsd-zfs  (1.8T)
> 
> =>        40  3905945520  mfid5  GPT  (1.8T)
>           40      532480      1  efi  (260M)
>       532520    16777216      3  freebsd-swap  (8.0G)
>     17309736  3888635824      4  freebsd-zfs  (1.8T)
> 
> ler in 🌐 borg in ~ via C v14.0.5-clang on ☁️  (us-east-1)
> ❯
> 
> Disk number and sizes vary but the setup is the same EFI or BOOT or Both,
> swap, and ZFS on *ALL* disks

By default disks are partitionned but.. that's all. You need to 
newfs_msdos and cp loader.efi on each but first EFI partition.
I don't understand the reason but I think some people will be upset when
the first disk dies and the system won't boot anymore...

> 
> -- 
> Larry Rosenman                     http://www.lerctr.org/~ler
> Phone: +1 214-642-9640                 E-Mail: ler@lerctr.org
> US Mail: 5708 Sabbia Dr, Round Rock, TX 78665-2106

-- 
Julien Cigar
Belgian Biodiversity Platform (http://www.biodiversity.be)
PGP fingerprint: EEF9 F697 4B68 D275 7B11  6A25 B2BB 3710 A204 23C0
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.