replacing zfs disk (freebsd-boot vs freebsd-efi)

Victor Sudakov vas at
Wed Oct 30 08:53:37 UTC 2019

mike tancsa wrote:
> In the past when replacing a disk in a zfs pool that I boot from, simply
> doing
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
> where
>     p1 = freebsd-boot
>     p2 = freebsd-swap
>     p3 = freebsd-zfs
> works just fine (ie. replacing ada0).  However, on this one box, I
> noticed the disk has both freebsd-boot and efi
>     p1 = efi
>     p2 = freebsd-boot
>     p3 = freebsd-swap
>     p4 = freebsd-zfs
> If I replace ada0, what do I need to do in order to full restore boot
> functionality to the disk ?

May I suggest that if it's really a UEFI system, you probably don't need
the freebsd-boot partition at all, nor any boot blocks or {P,M,V}BRs.

Just make sure that the EFI (p1) partition is formatted as FAT (even
FAT16 would do) and contains the \EFI\BOOT\BOOTX64.EFI loader.

The command "gpart bootcode -p /boot/boot1.efifat -i 1 ada0" 
may be a convenient way of copying the FAT partition image to the p1
partition, but certainly not the only one to format and populate it.
You could use an MS-DOS floppy as well for the purpose.

> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0

The above ^^^^^ should be unnecessary. Your UEFI firmware will find the
partition of the "efi" type and try to load /EFI/BOOT/BOOTX64.EFI from
there, which in turn will sniff your ZFS filesystems for the loader.

man 8 uefi

Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49 at fidonet
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <>

More information about the freebsd-questions mailing list