Yesterday I modified a server from booting off a raidz2 array, to booting off a newly created zpool. Why? Because HBAs are a pain to boot off. Instead, this server is now booting off a ZFS mirror of two SSDs, both of which are directly attached to the M/B.
Today, I am upgrading this server from FreeBSD 10.3 to FreeBSD 11.1 by making use of beadm.
Not all steps of the freebsd-update process are shown. Be warned. I assume you are reading this blog post only because you want to know more about beadm. I assume you are completely familiar and comfortable with freebsd-update. If you are not, please read something else.
What is beadm?
beadmn is a command line tool which allows you to clone an existing boot environment, thereby saving it away, while you upgrade a system. Should anything go wrong, you can tell beadm to boot from the saving environment, and then you are back where you started.
Recently installs of FreeBSD are beadm ready. They look something like this:
[dan@knew:~] $ zfs list -r zroot NAME USED AVAIL REFER MOUNTPOINT zroot 10.2G 9.04G 23K /zroot zroot/ROOT 7.57G 9.04G 23K none zroot/ROOT/default 7.57G 9.04G 7.23G / zroot/tmp 42K 2.00G 26K /tmp zroot/usr 641M 9.04G 23K /usr zroot/usr/local 641M 9.04G 375M /usr/local zroot/var 2.01G 9.04G 25K /var zroot/var/audit 23K 9.04G 23K /var/audit zroot/var/crash 1.50G 9.04G 1.50G /var/crash zroot/var/empty 23K 9.04G 23K /var/empty zroot/var/log 519M 1017M 519M /var/log zroot/var/mail 43K 457K 27K /var/mail zroot/var/tmp 65K 2.00G 49K /var/tmp [dan@knew:~] $
In general, you are looking for that zroot/ROOT/default dataset which is mounted at /. The names can be different, but that is the key detail.
Converting a non-beadm configuration into a beadm-configuration is outside the scope of this blog post.
Consider beadm a safety net when upgrading.
Creating the save point
Let’s see what beadm sees.
[dan@knew:~] $ beadm list BE Active Mountpoint Space Created default NR / 7.0G 2017-09-28 21:37
In this case, the default BE (Boot Environment) is default. There is only one BE.
This system is now running FreeBSD 10.3 so I will create a snapshot of the existing boot environment, named 10.3-RELEASE. This is my safety net.
[dan@knew:~] $ sudo beadm create 10.3-RELEASE
[dan@knew:~] $ beadm list BE Active Mountpoint Space Created default NR / 7.0G 2017-09-28 21:37 10.3-RELEASE - - 1.0K 2017-09-30 19:49
There we go.
Next, I recursively snapshot every zpool:
[dan@knew:~] $ zpool list NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT system 45.2T 3.42T 41.8T - 7% 7% 1.00x ONLINE - tank_data 45.2T 35.1T 10.2T - 16% 77% 1.00x ONLINE - zroot 19.9G 10.2G 9.67G - 28% 51% 1.00x ONLINE - [dan@knew:~] $ sudo zfs snapshot -r system@Before11.1 [dan@knew:~] $ sudo zfs snapshot -r zroot@Before11.1 [dan@knew:~] $ sudo zfs snapshot -r tank_data@Before11.1 [dan@knew:~] $
Following the handbook recommendations, I carried out the following steps:
As mentioned above, not all steps for upgrading are shown.
[dan@knew:~] $ sudo freebsd-update -r 11.1-RELEASE upgrade
I went through that entire upgrade process, then did another list, just to see. It added another 0.2GB:
[dan@knew:~] $ beadm list BE Active Mountpoint Space Created default NR / 7.2G 2017-09-28 21:37 10.3-RELEASE - - 175.0K 2017-09-30 19:49
Then I rebooted. I saw:
[dan@knew:~] $ uname -a FreeBSD knew.int.example.org 11.1-RELEASE-p1 FreeBSD 11.1-RELEASE-p1 #0: Wed Aug 9 11:55:48 UTC 2017 email@example.com:/usr/obj/usr/src/sys/GENERIC amd64
On to the rest of the upgrade.
[dan@knew:~] $ sudo /usr/sbin/freebsd-update install [dan@knew:~] $ sudo pkg upgrade -f [dan@knew:~] $ sudo /usr/sbin/freebsd-update install
And because I was running jails managed by ezjail:
[dan@knew:~] $ sudo ezjail-admin update -s 10.3-RELEASE -U
Then upgrade the jails
One of the issues with ezjail: that upgrade process does the whole shebang. Now, you have to upgrade the packages in each jail, and some tools will not work, because the 10.3 libraries are gone.
I’m running that upgrade now.