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

mike tancsa mike at
Tue Oct 29 14:17:42 UTC 2019

In the past when replacing a disk in a zfs pool that I boot from, simply

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0

    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 ?

gpart bootcode -b /boot/pmbr -p /boot/boot1.efifat -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 2 ada0

gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0


And is it boot1.efi or boot1.efifat ? I am guessing I also need the lable ?

gpart modify -l efiboot2 -i 1 ada0

e.g. current ada0 is

Geom name: ada0
modified: false
state: OK
fwheads: 16
fwsectors: 63
last: 976773127
first: 40
entries: 128
scheme: GPT
1. Name: ada0p1
   Mediasize: 209715200 (200M)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 20480
   Mode: r0w0e0
   efimedia: HD(1,GPT,a1ffb215-ff5c-11e8-98c7-ac1f6b70b306,0x28,0x64000)
   rawuuid: a1ffb215-ff5c-11e8-98c7-ac1f6b70b306
   rawtype: c12a7328-f81f-11d2-ba4b-00a0c93ec93b
   label: efiboot0
   length: 209715200
   offset: 20480
   type: efi
   index: 1
   end: 409639
   start: 40
2. Name: ada0p2
   Mediasize: 524288 (512K)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 209735680
   Mode: r0w0e0
   efimedia: HD(2,GPT,a20b59f0-ff5c-11e8-98c7-ac1f6b70b306,0x64028,0x400)
   rawuuid: a20b59f0-ff5c-11e8-98c7-ac1f6b70b306
   rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
   label: gptboot0
   length: 524288
   offset: 209735680
   type: freebsd-boot
   index: 2
   end: 410663
   start: 409640

More information about the freebsd-questions mailing list