I'm just getting started with BEs and ZFS. As I build my understanding, reading other people's tutorials, etc, I feel like there are a few distinct ways that BEs can be used to (eg) upgrade a system. Below is my current view — does anyone do anything different? I'm just trying to see what different options are out there, with different pros and cons.
(Aside: some threads on a similar topic: https://forums.freebsd.org/threads/boot-environments-beadm.87789/, https://forums.freebsd.org/threads/...ot-environments-with-make-installworld.84677/)
ZFS datasets
First, there is the question of how to arrange the ZFS datasets — the main ones being "shallow" or "deep", as described in the bectl(8) manpage. The older beadm tool seems to assume "shallow," and that's also what the installer uses when setting up boot-from-zfs. So, that's what I have.
▶ I wonder: Do many of you use the "deep" layout (or something else)? What advantages are there, other than being a more readable/obvious?
Upgrade Process
Second, there is the process used to actually perform an upgrade and roll back if needed.
It seems like there are roughly 4 approaches, but I wonder if any of you do something different?
Also, for all of these, I think there is still a separate concern of upgrading the BIOS/EFI boot loader, between releases? That stuff is outside of ZFS, so not covered by BEs, as I understand it.
Let's say we're currently in a "v99" BE and are upgrading to v100; here are the approaches as I see them:
A:
B:
This is essentially the same as (A), except rather than using special flags to do an upgrade in a dest directory, we would use either
Example w/chroot: https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-with-zfs-boot-environments/
Downsides: You need some familiarity with chroot/jail. The
C:
D:
----
Most guides I've seen use approach (A) or (B). Personally, (C) appeals to me since it seems the most foolproof.
▶ Do you use one of those, or something different?
(Aside: some threads on a similar topic: https://forums.freebsd.org/threads/boot-environments-beadm.87789/, https://forums.freebsd.org/threads/...ot-environments-with-make-installworld.84677/)
ZFS datasets
First, there is the question of how to arrange the ZFS datasets — the main ones being "shallow" or "deep", as described in the bectl(8) manpage. The older beadm tool seems to assume "shallow," and that's also what the installer uses when setting up boot-from-zfs. So, that's what I have.
▶ I wonder: Do many of you use the "deep" layout (or something else)? What advantages are there, other than being a more readable/obvious?
Upgrade Process
Second, there is the process used to actually perform an upgrade and roll back if needed.
It seems like there are roughly 4 approaches, but I wonder if any of you do something different?
Also, for all of these, I think there is still a separate concern of upgrading the BIOS/EFI boot loader, between releases? That stuff is outside of ZFS, so not covered by BEs, as I understand it.
Let's say we're currently in a "v99" BE and are upgrading to v100; here are the approaches as I see them:
A:
- create new BE called v100
- mount it somewhere (/tmp/v100)
- upgrade inside that mount, using appropriate flags (such as
freebsd-update -b /tmp/v100
ormake DESTDIR=/tmp/v100 ...
, etc) - unmount
- reboot into it, confirm all is well
- If something goes wrong, activate the old v99 BE.
B:
This is essentially the same as (A), except rather than using special flags to do an upgrade in a dest directory, we would use either
chroot
or jail
, and then use the "normal" upgrade commands inside there.Example w/chroot: https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-with-zfs-boot-environments/
Downsides: You need some familiarity with chroot/jail. The
bectl
tool has built-in support for jail/unjail, though.C:
- create new BE called v100
- reboot into it immediately
- upgrade the running system
- reboot again (to complete the upgrade), confirm all is well
- If something goes wrong, activate the old v99 BE.
D:
- create new BE called v99-backup
- rename the current BE v99 to v100
- upgrade the running system
- reboot into it, confirm all is well
- If something goes wrong, activate the v99-backup BE.
- optionally, rename v99-backup to plain v99.
----
Most guides I've seen use approach (A) or (B). Personally, (C) appeals to me since it seems the most foolproof.
▶ Do you use one of those, or something different?