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

mike tancsa mike at
Wed Oct 30 12:53:02 UTC 2019

On 10/30/2019 4:53 AM, Victor Sudakov wrote:
> 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.
Thanks for the confirmation and explanation.  I wonder if an added note
after a re-sliver would be a good idea

--- zpool_main.c.orig   2019-10-30 08:44:12.688304000 -0400
+++ zpool_main.c        2019-10-30 08:49:40.292540000 -0400
@@ -5856,6 +5856,8 @@
                    "the following command will do it:\n"
                    "\tgpart bootcode -b /boot/pmbr -p /boot/gptzfsboot
-i 1 da0\n\n",
+                   "\tor for EFI\n\n",
+                   "\tgpart bootcode -p /boot/boot1.efifat -i 1 da0\n\n",

> 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.

I think FreeBSD's install added it by default. I wonder if that was done
to make the disks portable between EFI and non EFI systems ? I will have
to test to see if thats the case.


More information about the freebsd-questions mailing list