Upgrade FreeBSD with ZFS Boot Environments

vermaden

Son of Beastie

Reaction score: 1,487
Messages: 2,963

I am known as a strong ZFS Boot Environment supported … and not without a reason. I have stated the reasons ‘why’ many times but most (or all) of them are condensed here – https://is.gd/BECTL – in my presentation about it.

The upcoming FreeBSD 13.0-RELEASE looks very promising. In many tests it is almost TWICE as fast as the 12.2-RELEASE. Ouch!



The detailed tests are available on the phoronix.com site.

Having 12.2-RELEASE installed I wanted to check 13.0-BETA* to check if things that are important for me – like working suspend/resume for example – work as advertised on the newer version. It is the perfect task that can be achieved by using ZFS Boot Environments.

In the example below we will create entire new ZFS Boot Environment with clone of our current 12.2-RELEASE system and upgrade it there (in BE) to the 13.0-BETA3 version … and there will only be required on reboot – not three as in typical freebsd-update(8) upgrade procedure.

I assume that you have FreeBSD 12.2-RELEASE installed with ZFS (default ZFS FreeBSD install) and its installed in UEFI or UEFI+BIOS mode.

Here are the steps that will be needed.

# beadm create 13 # create new ZFS Boot Environment
# beadm mount 13 # mount new BE somewhere
# chroot /var/tmp/BE-13.z4IanfZt # make a chroot(8) into that place
# mount -t devfs devfs /dev # mount the devfs(8) in that BE
# rm -rf /var/db/freebsd-update # remove any old patches

# mkdir /var/db/freebsd-update # create fresh dir for patches
# freebsd-update upgrade -r 13.0-BETA3 # fetch the patches needed for upgrade
# freebsd-update install # install the kernel and kernel modules
# freebsd-update install # install the userspace/binaries/libraries
# pkg upgrade # upgrade all installed packages with pkg(8)
# freebsd-update install # remove old libraries and unneeded files
# beadm activate 13 # activate new '13' BE


I am using mine sysutils/beadm for the process but you as well may use the bectl(8) from FreeBSD base system.

We will also need new FreeBSD loader(8) which will be updated this way – thanks to @JeffSipek for pointing that out.

On my system FreeBSD is installed on ada1 device.

# gpart show -p ada1 | grep efi # find the UEFI msdosfs(5) partition
40 409600 ada1p1 efi (200M) # <-- this one
# mount_msdosfs /dev/ada1p1 /mnt # mount in under /mnt
# find /mnt # display its contents
/mnt
/mnt/efi
/mnt/efi/boot
/mnt/efi/boot/bootx64.efi # we need to update bootx64.efi file
# cp /boot/boot1.efi /mnt/efi/boot/bootx64.efi # copy from /boot/boot1.efi file
# umount /mnt # unmount the /mnt filesystem


The last step is to reboot(8) into the new 13.0-BETA3 system.

# reboot


If you find any problems with new bootloader not being able to load your new FreeBSD then you may alternatively copy the /boot/loader.efi instead of /boot/boot1.efi into the /mnt/efi/boot/bootx64.efi place.

Done. You should now see the new FreeBSD loader(8) in all its glory
🙂




You may now enjoy latest FreeBSD 13.0-BETA3 installation.

Same steps will be required to update to soon to be available FreeBSD 13.0-RC* (RC1/RC2/RC3) version and finally FreeBSD 13.0-RELEASE hopefully somewhere in March 2021.

EOF

Continue reading...
 
Top