A Short bectl Guide for FreeBSD and GhostBSD Users
What Is a Boot Environment?
A boot environment (BE) is a bootable copy of your operating system stored on ZFS. It allows you to test upgrades, install software, or modify system configuration without risking your current working system.
If something goes wrong, you can boot an earlier environment and continue working.
Viewing Boot Environments
List all boot environments:
bectl list
Example:
BE Active Mountpoint Space Created
default NR / 2.1G 2026-06-01
pre-upgrade - - 500M 2026-05-31
Active Flags
- N — Active now.
- R — Active on reboot.
- T — Active for the next boot only.
- Combinations such as NR and NRT are possible.
Creating a Boot Environment
Before making major changes:
sudo bectl create pre-upgrade
This creates a new boot environment cloned from the currently running system.
Testing Changes Safely
The safest workflow is to activate a boot environment for one boot only:
sudo bectl activate -t pre-upgrade
sudo reboot
The system will boot into pre-upgrade once. If the upgrade fails, a subsequent reboot returns to the normal default boot environment.
Making a Boot Environment Permanent
If testing succeeds:
sudo bectl activate pre-upgrade
Future boots will use this environment until another boot environment is activated.
Working with Snapshots
Create a snapshot of a boot environment:
sudo bectl create pre-upgrade@clean
List snapshots:
bectl list -s
A snapshot is not a boot environment and cannot be activated directly.
To create a new boot environment from a snapshot:
sudo bectl create -e pre-upgrade@clean recovery
The new boot environment can then be activated and booted.
Mounting a Boot Environment
Mount a boot environment for inspection:
sudo bectl mount pre-upgrade /mnt
When finished:
sudo bectl unmount pre-upgrade
Renaming a Boot Environment
sudo bectl rename pre-upgrade freebsd-15.0
Descriptive names make older environments easier to identify.
Removing a Boot Environment
Delete an unused boot environment:
sudo bectl destroy old-be
Delete a snapshot:
sudo bectl destroy pre-upgrade@clean
Only remove environments you no longer need.
Recommended Upgrade Procedure
Create a boot environment:
sudo bectl create pre-upgrade
Activate it for one boot:
sudo bectl activate -t pre-upgrade
sudo reboot
Perform the upgrade.
If the system operates correctly, make the boot environment permanent:
sudo bectl activate pre-upgrade
Keep the previous environment until you are satisfied that the upgraded system is stable.
Best Practices
- Create a boot environment before every operating-system upgrade.
- Use
activate -t when testing significant changes.
- Keep at least one known-good boot environment.
- Remove obsolete environments periodically.
- Remember that boot environments protect the operating system, not your personal files.
Remember
Boot environments are one of the most valuable features of ZFS. They provide a simple method of testing upgrades and recovering from mistakes with little more than a reboot.