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
	still be used, but some features are unavailable.
	the features. See zpool-features(7) for details.
  scan: none requested

	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':

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:


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.