Update UEFI boot code after ZFS upgrade on FreeBSD
Whenever a new FreeBSD version supports new features for ZFS, an upgrade of the existing pools is necessary. This is indicated when the status of a pool is displayed:
# zpool status zroot
pool: zroot
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
scan: none requested
config:
NAME STATE READ WRITE CKSUM
zroot ONLINE 0 0 0
da0p2.eli ONLINE 0 0 0
errors: No known data errors
Performing the update is pretty straight forward, the necessary command is already listed. However, when the pool the system is booted from is updated, the following message appears:
# zpool upgrade -a
This system supports ZFS pool feature flags.
Enabled the following features on 'zroot':
sha512
skein
If you boot from pool 'zroot', don't forget to update boot code.
Assuming you use GPT partitioning and da0 is your boot disk
the following command will do it:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0
The suggested command to update the boot code, however, only applies to systems still booting with the old BIOS. If you use it on a system booting with UEFI, the UEFI partition will be overwritten and is not recognized as bootable anymore.
The proper command to use on an UEFI system is the following:
# gpart bootcode -p /boot/boot1.efifat -i 1 da0
Make sure to apply this to all disks of the boot pool.