BECTL(8)

๐Ÿ“ฆ
version 15.1 ยท 2 versions
, in freebsd 15.1

๐Ÿฆ‹ BECTL(8) ๐Ÿฆ‹

okay bestie, grab a snack ๐Ÿ“ โ€” this is bectl, straight out of the System Manager's Manual, and she's literally the icon of ZFS boot environments ๐Ÿ’…

๐ŸŒธ NAME ๐ŸŒธ

bectl โ€” manage ZFS boot environments ๐Ÿ‘‘

โœจ SYNOPSIS โœจ

bectl [-h]
bectl [-r beroot] activate [-t | -T] beName
bectl [-r beroot] check
bectl [-r beroot] create [-r] [-e {nonActiveBe | beName@snapshot}]
      newBeName
bectl [-r beroot] create [-r] beName@snapshot
bectl [-r beroot] create -E newBeName
bectl [-r beroot] destroy [-Fo] beName[@snapshot]
bectl [-r beroot] export sourceBe
bectl [-r beroot] import targetBe
bectl [-r beroot] jail [-bU] [{-o key=value | -u key}]... beName
      [utility [argument ...]]
bectl [-r beroot] list [-aDHs] [-c property] [-C property] [{-c property
      | -C property}]
bectl [-r beroot] mount beName [mountpoint]
bectl [-r beroot] rename origBeName newBeName
bectl [-r beroot] {ujail | unjail} {jailId | jailName | beName}
bectl [-r beroot] {umount | unmount} [-f] beName

๐Ÿซถ DESCRIPTION ๐Ÿซถ

So the bectl utility manages bootable ZFS clones called boot environments โ€” and honestly? main character energy โœจ Boot environments let you test system changes safely, because they're selectable directly from the boot loader(8). No cap, that's the whole point ๐Ÿ™Œ

This utility can create, list, mount, or jail boot environments. And once you've tested your changes? The boot environment can be unmounted, activated, renamed, and destroyed. Full arc, beginning to end ๐Ÿ’–


๐Ÿ’… Supported Subcommands and Flags ๐Ÿ’…

  • -h โ€” prints usage information and exits. that's it, that's the whole job ๐Ÿ™ˆ
  • -r beroot subcommand โ€” specifies a parent dataset for the boot environment to use for subcommand, for operation on manually imported pools or unusual layouts ๐Ÿงš
  • activate [-t | -T] beName โ€” activates the given beName as the default boot filesystem ๐Ÿ”ฅ If the -t flag is given, this takes effect only for the next boot. Flag -T removes temporary boot once configuration. Without temporary configuration, the next boot will use the zfs dataset specified in the boot pool bootfs property โญ
  • check โ€” performs a check to see if the current system can use boot environments ๐Ÿฉบ If boot environments are supported and used, bectl will exit with a status code of 0. Any other status code is not currently defined and may, in the future, grow special meaning for different degrees of sanity check failures ๐Ÿ‘€
  • create [-r] [-e {nonActiveBe | beName@snapshot}] newBeName โ€” creates a new boot environment named newBeName ๐ŸŒฑ
    • If the -r flag is given, a recursive boot environment will be made. See โ€œBoot Environment Structuresโ€ for a discussion on different layouts ๐Ÿ—‚๏ธ
    • If the -e flag is specified, the new environment will be cloned from the given nonActiveBe or beName@snapshot. Otherwise, the new environment will be created from the currently booted environment ๐Ÿ’ซ
    • If bectl is creating from another boot environment, a snapshot of that boot environment will be created to clone from ๐Ÿ“ธ
  • create [-r] beName@snapshot โ€” creates a snapshot of the boot environment named beName ๐ŸŽ€
    • If the -r flag is given, a recursive snapshot of the boot environment will be created. A snapshot is created for each descendant dataset of the boot environment ๐ŸŒณ See โ€œBoot Environment Structuresโ€ for a discussion on different layouts.
    • Heads up: no new boot environment is created with this subcommand ๐Ÿšซ
  • create -E newBeName โ€” creates a new empty boot environment named newBeName ๐Ÿซง
  • destroy [-Fo] beName[@snapshot] โ€” destroys the given beName boot environment or beName@snapshot snapshot without confirmation, unlike in beadm(8) ๐Ÿ’€ Specifying -F will automatically unmount without confirmation ๐Ÿ™ˆ
    • By default, bectl will warn that it is not destroying the origin of beName. The -o flag may be specified to destroy the origin as well ๐Ÿ”ฅ
  • export sourceBe โ€” exports sourceBe to stdout(4). stdout(4) must be piped or redirected to a file ๐Ÿ“ค
  • import targetBe โ€” imports targetBe from stdin(4) ๐Ÿ“ฅ
  • jail [-bU] [{-o key=value | -u key}]... beName [utility [argument ...]] โ€” creates a jail of the given boot environment ๐Ÿฐ Multiple -o and -u arguments may be specified. -o will set a jail parameter, and -u will unset a jail parameter ๐ŸŽ›๏ธ
    • By default, jails are created in interactive mode and /bin/sh is executed within the jail. If utility is specified, it will be executed instead of /bin/sh โšก The jail will be destroyed and the boot environment unmounted when the command finishes executing, unless the -U argument is specified ๐Ÿ‘‘
    • The -b argument enables batch mode, thereby disabling interactive mode. The -U argument will be ignored in batch mode โš ๏ธ
    • The name, host.hostname, and path must be set โ€” the default values are specified below ๐Ÿ“
    • All key=value pairs are interpreted as jail parameters as described in jail(8) ๐Ÿงš The following default parameters are provided:
      • allow.mount โ€” true
      • allow.mount.devfs โ€” true
      • enforce_statfs โ€” 1
      • name โ€” set to jail ID
      • host.hostname โ€” bootenv
      • path โ€” set to a path in /tmp generated by libbe(3)
    • All default parameters may be overwritten ๐Ÿ’…
  • list [-aDHs] [{-c property | -C property}] โ€” displays all boot environments ๐Ÿ“‹ The Active field indicates whether the boot environment is active now (N); active on reboot (R); is used on next boot once (T); or combination of (NRT) ๐Ÿ‘€
    • -a โ€” display all datasets.
    • -D โ€” display the full space usage for each boot environment, assuming all other boot environments were destroyed.
    • -H โ€” used for scripting. Do not print headers and separate fields by a single tab instead of arbitrary white space.
    • -s โ€” display all snapshots as well.
    • -c property โ€” sort boot environments by the given ZFS dataset property. The following properties are supported:
      • name (the default)
      • creation
      • origin
      • used
      • usedbydataset
      • usedbyrefreservation
      • usedbysnapshots
      • Short forms usedds, usedrefreserv and usedsnap are also supported ๐Ÿ’ซ
    • -C property โ€” same as the -c option, but displays in descending order ๐Ÿ”„
    • The -D option is ignored when either the -s or -a option is used โš ๏ธ
  • mount beName [mountpoint] โ€” mounts the given boot environment ๐Ÿ—ป
    • If a nonexistent mountpoint is given: bectl will make the directory, including intermediate directories as required ๐Ÿช„
    • If no mountpoint is given: bectl will make a directory such as be_mount.c6Sf in /tmp. Randomness in the last four characters of the directory name will prevent mount point conflicts ๐ŸŽฒ Unmount of an environment, followed by mount of the same environment without giving a mountpoint, will result in a different randomly-named mountpoint ๐Ÿ‘€
  • rename origBeName newBeName โ€” renames the given origBeName to the given newBeName โœ๏ธ The boot environment will not be unmounted for this rename to occur ๐Ÿซถ
  • ujail {jailId | jailName | beName}
  • unjail {jailId | jailName | beName} โ€” destroys the jail created from the given boot environment ๐Ÿ’ฅ
  • umount [-f] beName
  • unmount [-f] beName โ€” unmounts the given boot environment, if it is mounted ๐Ÿ’ค Specifying -f will force the unmount if busy โš ๏ธ
    • Unmount will not remove the mount point ๐Ÿšซ

๐ŸŒˆ Boot Environment Structures ๐ŸŒˆ

The traditional FreeBSD boot environment layout โ€” as created by the Auto ZFS option to bsdinstall(8) โ€” is a โ€œshallowโ€ boot environment structure, where boot environment datasets do not have any directly subordinate datasets ๐Ÿ™…โ€โ™€๏ธ Instead, they're organized off in zroot/ROOT, and they rely on datasets elsewhere in the pool having canmount set to off ๐Ÿง For instance, a simplified pool may be laid out as such:

% zfs list -o name,canmount,mountpoint
NAME                    CANMOUNT        MOUNTPOINT
zroot
zroot/ROOT              noauto          none
zroot/ROOT/default      noauto          none
zroot/home              on              /home
zroot/usr               off             /usr
zroot/usr/src           on              /usr/src
zroot/var               off             /var

In that example, zroot/usr has canmount set to off, thus files in /usr typically fall into the boot environment because this dataset is not mounted ๐Ÿซง zroot/usr/src is mounted, thus files in /usr/src are not in the boot environment ๐Ÿšซ

The other style of boot environments in use โ€” frequently called โ€œdeep boot environmentsโ€ โ€” organizes some or all of the boot environment as subordinate to the boot environment dataset ๐Ÿ’– For example:

% zfs list -o name,canmount,mountpoint
NAME                            CANMOUNT        MOUNTPOINT
zroot
zroot/ROOT                      noauto          none
zroot/ROOT/default              noauto          none
zroot/ROOT/default/usr          noauto          /usr
zroot/ROOT/default/usr/local    noauto          /usr/local
zroot/var                       on              /var

Note that the subordinate datasets now have canmount set to noauto โญ These are more obviously a part of the boot environment, as indicated by their positioning in the layout ๐Ÿ‘‘ These subordinate datasets will be mounted by the zfsbe rc(8) script at boot time ๐ŸŒ… In this example, /var is excluded from the boot environment ๐Ÿ™…โ€โ™€๏ธ

bectl subcommands that have their own -r operate on this second, โ€œdeepโ€ style of boot environment, when the -r flag is set ๐Ÿ”ฅ A future version of bectl may default to handling both styles and deprecate the various -r flags ๐Ÿ”ฎ

๐ŸŽ€ EXAMPLES ๐ŸŽ€

Create a boot environment, named with today's date, containing snapshots of the root dataset and of all child datasets ๐ŸŒธ:

bectl create -r `date +%Y%m%d`

Mount a previous boot environment, yesterdaysbe, to /mnt ๐ŸŒ™:

bectl mount yesterdaysbe /mnt

๐ŸŒŸ SEE ALSO ๐ŸŒŸ

libbe(3), zfsprops(7), beinstall.sh(8), jail(8), loader(8), zfs(8), zpool(8) ๐Ÿซถ

๐Ÿ“œ HISTORY ๐Ÿ“œ

bectl and libbe(3) were written by Kyle Kneitinger (kneitinger) <kyle@kneit.in> as a 2017 Google Summer of Code project, with Allan Jude (allanjude) <allanjude@freebsd.org> as mentor ๐ŸŽ“

bectl and this manual page were derived from beadm(8) ๐Ÿ’ซ

๐Ÿซถ AUTHORS ๐Ÿซถ

okay so before we log off, let's give the people their flowers fr fr, because this whole thing did NOT build itself ๐Ÿ’

  • Slawomir Wojciech Wojtczak (vermaden) <vermaden@interia.pl> โ€” the actual creator AND maintainer of beadm(8). the OG. the blueprint. main character energy from day one ๐Ÿ‘‘
  • Bryan Drewery (bdrewery) <bryan@shatow.net> โ€” contributed the child dataset fixes (iykyk, those are the messy ones ๐Ÿ˜ญ) and literally wrote the beadm(8) manual page. the way that he documented things so we could all understand themโ€ฆ iconic โœจ
  • Kyle Evans (kevans) <kevans@freebsd.org> โ€” wrote most of the later changes to bectl, and to this very page you're reading rn. not me being grateful to the person who made this page exist while I'm rewriting it ๐Ÿ’€๐Ÿ’–

so yeah, three absolute legends, no cap. respect the maintainers, they're carrying the whole boot environment situation on their backs ๐ŸŽ€


and that's the vibe check complete bestie!! ๐ŸŒˆ this page came from the Debian project, version info dated February 4, 2026, and the manual page is filed under BECTL(8) โ€” section 8, admin commands, where all the powerful stuff lives ๐Ÿ’… go forth and snapshot responsibly, mwah ๐Ÿฆ‹๐Ÿ’œ

๐Ÿ“ฆ where this page comes from
  • freebsd 15.1: base 15.1
  • ๐Ÿ“œ the page's license: BSD-2-Clause
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms