How to Use ZFS Boot Environments with bectl for Safe Upgrades
A complete walkthrough creating a boot environment before a risky change, and rolling back to it instantly from the boot loader if something goes wrong.
A boot environment is a bootable snapshot of your entire root filesystem — created instantly thanks to ZFS’s snapshot mechanism, and selectable directly from the boot loader if you need to roll back. bectl is FreeBSD’s built-in tool for managing them.
Step 1: confirm your system is actually on ZFS with boot environment support
bectl list
If this returns a list of boot environments (even just one, the current one), boot environments are available; this requires a ZFS root install, which has been the default FreeBSD installer option since FreeBSD 13 made ZFS the default root filesystem.
Step 2: create a boot environment before any risky change
bectl create pre-upgrade-14.1
This creates an instant, space-efficient snapshot-backed clone of your current root filesystem, named pre-upgrade-14.1 — the entire operation completes in a fraction of a second regardless of how much data is actually on the root filesystem, since it’s a ZFS clone, not a copy.
Step 3: perform the risky operation
freebsd-update upgrade -r 14.1-RELEASE
freebsd-update install
With the boot environment already created, a major version upgrade (or any other significant system change) now has a safety net in place before you begin.
Step 4: reboot and confirm the upgrade worked
reboot
freebsd-version
Step 5: if something is wrong, activate the previous boot environment
bectl activate pre-upgrade-14.1
reboot
This tells the boot loader to boot from the previous boot environment on the next restart — rolling back the entire system to its exact pre-upgrade state, not just the specific files the upgrade touched.
Step 6: select a boot environment directly from the boot loader, if needed
At the boot loader menu (before the OS starts):
→ Boot Environment Menu → select the desired environment
This works even if the currently-active boot environment is broken badly enough that it can’t reach a shell to run bectl itself — the boot loader’s own menu can select a different, working boot environment directly.
Step 7: clean up old boot environments once confident
bectl list
bectl destroy pre-upgrade-14.1
Boot environments consume space proportional to how much has diverged from the snapshot they’re based on — worth destroying ones you’re confident you no longer need, rather than accumulating them indefinitely.
Why this changes the risk calculus for upgrades entirely
Without boot environments, a major version upgrade that goes wrong typically means restoring from a backup (slow, and only as current as your last backup) or troubleshooting a partially-upgraded system live. With a boot environment created moments before the upgrade began, “this went wrong” becomes “activate the previous boot environment and reboot” — a rollback that’s as fast and complete as the snapshot that made it possible, which is exactly why creating one before any significant system change is worth making a habit rather than an occasional precaution.