Upgrading to FreeBSD 13.0

By: Jason Tubnor @tubsta

An email hit the freebsd-stable mail list the other day that reminded me with the upcoming release of FreeBSD 13 that includes OpenZFS 2.0, there is a bit of housekeeping that is required post upgrade, especially if you want to take advantage of the new zpool(8) features.

The zpool(8) upgrade command will no longer remind you with an example to update your systems boot loader. If you are not booting from ZFS, this can be ignored but it is a typical issue people run into when performing major FreeBSD updates.

UEFI is a bit different than CSM/legacy boot. There have been slight changes in how the FAT partition for UEFI is managed, making it a lot easier for users when the feature set improves for subsequent releases. Remember, if you use a mirrored zfs root, you need to do this to both boot disks as the UEFI FAT partition is not mirrored:

gpart show # to verify the correct disks and slices that are used for zfs-root
mount -t msdosfs /dev/ada0p1 /mnt
cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi
umount /mnt
mount -t msdosfs /dev/ada1p1 /mnt
cp /boot/loader.efi /mnt/EFI/BOOT/BOOTX64.efi
umount /mnt

Typically, if the FreeBSD installer has been used for a UEFI build, p1 will be the partition used for either legacy boot or the UEFI FAT partition. Validating with ‘gpart show‘ will ensure you don’t overwrite the wrong partition.

The CSM/legacy boot is a lot simpler and just requires the boot code to be replaced (no mounting of file systems etc). Still perform the ‘gpart show‘ to validate the location of the gptzfsboot code:

gpart show # to verify the correct disks and slices that are used for zfs-root
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1

Reboot and enjoy the new features of OpenZFS 2.0.

A final note, the safest way would be performing the above after the system upgrade but before the zpool(8) upgrade. This is to ensure that your system will still boot in the event of crash or power failure. New boot code is always backwards compatible so installing the newer code, your system will still boot prior to the zpool(8) upgrade and the upgrade can now happen safely at anytime that’s convenient.