1.\" 2.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3.\" 4.\" Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in> 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" 17.\" @(#)be.1 18.\" 19.\" $FreeBSD$ 20.\" 21.Dd August 22, 2018 22.Dt BECTL 8 23.Os 24.Sh NAME 25.Nm bectl 26.Nd Utility to manage Boot Environments on ZFS 27.Sh SYNOPSIS 28.Nm 29.Cm activate 30.Op Fl t 31.Ar beName 32.Nm 33.Cm create 34.Op Fl r 35.Op Fl e Brq Ar nonActiveBe | beName@snapshot 36.Ar beName 37.Nm 38.Cm create 39.Op Fl r 40.Ar beName@snapshot 41.Nm 42.Cm destroy 43.Op Fl F 44.Brq Ar beName | beName@snapshot 45.Nm 46.Cm export 47.Ar sourceBe 48.Nm 49.Cm import 50.Ar targetBe 51.Nm 52.Cm jail 53.Brq Fl b | Fl U 54.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... 55.Brq Ar jailID | jailName 56.Ar bootenv 57.Op Ar utility Op Ar argument ... 58.Nm 59.Cm list 60.Op Fl DHas 61.Nm 62.Cm mount 63.Ar beName 64.Op mountpoint 65.Nm 66.Cm rename 67.Ar origBeName 68.Ar newBeName 69.Nm 70.Brq Cm ujail | unjail 71.Brq Ar jailID | jailName 72.Ar bootenv 73.Nm 74.Brq Cm umount | unmount 75.Op Fl f 76.Ar beName 77.Sh DESCRIPTION 78The 79.Nm 80command is used to setup and interact with ZFS boot environments, which are 81bootable clones of datasets. 82.Pp 83.Em Boot Environments 84allows the system to be upgraded, while preserving the old system environment in 85a separate ZFS dataset. 86.Sh COMMANDS 87The following commands are supported by 88.Nm : 89.Bl -tag -width activate 90.It Xo 91.Cm activate 92.Op Fl t 93.Ar beName 94.Xc 95Activate the given 96.Ar beName 97as the default boot filesystem. 98If the 99.Op Fl t 100flag is given, this takes effect only for the next boot. 101.It Xo 102.Cm create 103.Op Fl r 104.Op Fl e Brq Ar nonActiveBe | beName@snapshot 105.Ar beName 106.Xc 107Creates a new boot environment named 108.Ar beName . 109If the 110.Fl e 111argument is specified, the new environment will be cloned from the given 112.Brq Ar nonActiveBe | Ar beName@snapshot . 113If the 114.Fl r 115flag is given, a recursive boot environment will be made. 116.It Xo 117.Cm create 118.Op Fl r 119.Ar beName@snapshot 120.Xc 121Creates a snapshot of the existing boot environment named 122.Ar beName . 123If the 124.Fl r 125flag is given, a recursive boot environment will be made. 126.It Xo 127.Cm destroy 128.Op Fl F 129.Brq Ar beName | beName@snapshot 130.Xc 131Destroys the given 132.Ar beName 133boot environment or 134.Ar beName@snapshot 135snapshot. 136Specifying 137.Fl F 138will automatically unmount without confirmation. 139.It Cm export Ar sourceBe 140Export 141.Ar sourceBe 142to 143.Dv stdout . 144.Dv stdout 145must be piped or redirected to a file. 146.It Cm import Ar targetBe 147Import 148.Ar targetBe 149from 150.Dv stdin . 151.It Xo 152.Cm jail 153.Brq Fl b | Fl U 154.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... 155.Brq Ar jailID | jailName 156.Ao Ar bootenv Ac 157.Op Ar utility Op Ar argument ... 158.Xc 159Creates a jail of the given boot environment. 160Multiple 161.Fl o 162and 163.Fl u 164arguments may be specified. 165.Fl o 166will set a jail parameter, and 167.Fl u 168will unset a jail parameter. 169.Pp 170By default, jails are created in interactive mode and 171.Pa /bin/sh 172is 173executed within the jail. 174If 175.Ar utility 176is specified, it will be executed instead of 177.Pa /bin/sh . 178The jail will be destroyed and the boot environment unmounted when the command 179finishes executing, unless the 180.Fl U 181argument is specified. 182.Pp 183The 184.Fl b 185argument enables batch mode, thereby disabling interactive mode. 186The 187.Fl U 188argument will be ignored in batch mode. 189.Pp 190The 191.Va name , 192.Va host.hostname , 193and 194.Va path 195may not actually be unset. 196Attempts to unset any of these will revert them to the default values specified 197below, if they have been overwritten by 198.Fl o . 199.Pp 200All 201.Ar key Ns = Ns Ar value 202pairs are interpreted as jail parameters as described in 203.Xr jail 8 . 204The following default parameters are provided: 205.Bl -column "allow.mount.devfs" "" 206.It Va allow.mount Ta Cm true 207.It Va allow.mount.devfs Ta Cm true 208.It Va enforce_statfs Ta Cm 1 209.It Va name Ta Va bootenv 210.It Va host.hostname Ta Va bootenv 211.It Va path Ta Set to a path in /tmp generated by 212.Xr libbe 3 . 213.El 214.Pp 215All default parameters may be overwritten. 216.It Cm list Op Fl DHas 217Displays all boot environments. 218The Active field indicates whether the boot environment is active now (N); 219active on reboot (R); or both (NR). 220.Pp 221If 222.Fl a 223is used, display all datasets. 224If 225.Fl D 226is used, display the full space usage for each boot environment, assuming all 227other boot environments were destroyed. 228The 229.Fl H 230option is used for scripting. 231It does not print headers and separate fields by a single tab instead of 232arbitrary white space. 233If 234.Fl s 235is used, display all snapshots as well. 236.It Cm mount Ar beName Op Ar mountpoint 237Temporarily mount the boot environment. 238Mount at the specified 239.Ar mountpoint 240if provided. 241.It Cm rename Ar origBeName newBeName 242Renames the given nonactive 243.Ar origBeName 244to the given 245.Ar newBeName . 246.It Cm unjail Brq Ar jailID | jailName | beName 247Destroys the jail created from the given boot environment. 248.It Xo 249.Cm unmount 250.Op Fl f 251.Ar beName 252.Xc 253Unmount the given boot environment, if it is mounted. 254Specifying 255.Fl f 256will force the unmount if busy. 257.El 258.Sh EXAMPLES 259.Bl -bullet 260.It 261To fill in with jail upgrade example when behavior is firm. 262.El 263.Sh SEE ALSO 264.Xr jail 8 , 265.Xr zfs 8 , 266.Xr zpool 8 267.Sh HISTORY 268.Nm 269is based on 270.Nm beadm 271and was implemented as a project for the 2017 Summer of Code, along with 272.Xr libbe 3 . 273.Sh AUTHORS 274.Nm 275was written by 276.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in . 277.Pp 278.Nm beadm 279was written and is maintained by 280.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl . 281.Pp 282.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net 283wrote the original 284.Nm beadm 285manual page that this one is derived from. 286