15952343eSKyle Evans.\" 2b179da01SKyle Evans.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3b179da01SKyle Evans.\" 4b179da01SKyle Evans.\" Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in> 5b179da01SKyle Evans.\" All rights reserved. 65952343eSKyle Evans.\" 75952343eSKyle Evans.\" Redistribution and use in source and binary forms, with or without 85952343eSKyle Evans.\" modification, are permitted provided that the following conditions 95952343eSKyle Evans.\" are met: 105952343eSKyle Evans.\" 1. Redistributions of source code must retain the above copyright 115952343eSKyle Evans.\" notice, this list of conditions and the following disclaimer. 125952343eSKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright 135952343eSKyle Evans.\" notice, this list of conditions and the following disclaimer in the 145952343eSKyle Evans.\" documentation and/or other materials provided with the distribution. 155952343eSKyle Evans.\" 165952343eSKyle Evans.\" 175952343eSKyle Evans.\" @(#)be.1 18b6e7c421SKyle Evans.\" 195952343eSKyle Evans.\" $FreeBSD$ 205952343eSKyle Evans.\" 21db9db0e7SKyle Evans.Dd August 22, 2018 22edbfe3bcSKyle Evans.Dt BECTL 8 2384e61219SKyle Evans.Os 245952343eSKyle Evans.Sh NAME 25edbfe3bcSKyle Evans.Nm bectl 265952343eSKyle Evans.Nd Utility to manage Boot Environments on ZFS 275952343eSKyle Evans.Sh SYNOPSIS 285952343eSKyle Evans.Nm 29*d81df689SKyle Evans.Cm activate 305952343eSKyle Evans.Op Fl t 31*d81df689SKyle Evans.Ar beName 325952343eSKyle Evans.Nm 33*d81df689SKyle Evans.Cm create 345952343eSKyle Evans.Op Fl r 35*d81df689SKyle Evans.Op Fl e Brq Ar nonActiveBe | beName@snapshot 36*d81df689SKyle Evans.Ar beName 375952343eSKyle Evans.Nm 38*d81df689SKyle Evans.Cm create 395952343eSKyle Evans.Op Fl r 40*d81df689SKyle Evans.Ar beName@snapshot 415952343eSKyle Evans.Nm 42*d81df689SKyle Evans.Cm destroy 435952343eSKyle Evans.Op Fl F 44*d81df689SKyle Evans.Brq Ar beName | beName@snapshot 455952343eSKyle Evans.Nm 46*d81df689SKyle Evans.Cm export 47*d81df689SKyle Evans.Ar sourceBe 4834761e84SKyle Evans.Nm 49*d81df689SKyle Evans.Cm import 50*d81df689SKyle Evans.Ar targetBe 5134761e84SKyle Evans.Nm 52*d81df689SKyle Evans.Cm jail 53*d81df689SKyle Evans.Brq Fl b | Fl U 54*d81df689SKyle Evans.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... 55*d81df689SKyle Evans.Brq Ar jailID | jailName 56*d81df689SKyle Evans.Ar bootenv 57cd816834SKyle Evans.Op Ar utility Op Ar argument ... 585952343eSKyle Evans.Nm 59*d81df689SKyle Evans.Cm list 60*d81df689SKyle Evans.Op Fl DHas 615952343eSKyle Evans.Nm 62*d81df689SKyle Evans.Cm mount 63*d81df689SKyle Evans.Ar beName 645952343eSKyle Evans.Op mountpoint 655952343eSKyle Evans.Nm 66*d81df689SKyle Evans.Cm rename 67*d81df689SKyle Evans.Ar origBeName 68*d81df689SKyle Evans.Ar newBeName 695952343eSKyle Evans.Nm 70*d81df689SKyle Evans.Brq Cm ujail | unjail 71*d81df689SKyle Evans.Brq Ar jailID | jailName 72*d81df689SKyle Evans.Ar bootenv 735952343eSKyle Evans.Nm 74*d81df689SKyle Evans.Brq Cm umount | unmount 755952343eSKyle Evans.Op Fl f 76*d81df689SKyle Evans.Ar beName 775952343eSKyle Evans.Sh DESCRIPTION 785952343eSKyle EvansThe 795952343eSKyle Evans.Nm 80*d81df689SKyle Evanscommand is used to setup and interact with ZFS boot environments, which are 81*d81df689SKyle Evansbootable clones of datasets. 825952343eSKyle Evans.Pp 835952343eSKyle Evans.Em Boot Environments 84*d81df689SKyle Evansallows the system to be upgraded, while preserving the old system environment in 85*d81df689SKyle Evansa separate ZFS dataset. 865952343eSKyle Evans.Sh COMMANDS 875952343eSKyle EvansThe following commands are supported by 885952343eSKyle Evans.Nm : 895952343eSKyle Evans.Bl -tag -width activate 90*d81df689SKyle Evans.It Xo 91*d81df689SKyle Evans.Cm activate 925952343eSKyle Evans.Op Fl t 93*d81df689SKyle Evans.Ar beName 94*d81df689SKyle Evans.Xc 955952343eSKyle EvansActivate the given 965952343eSKyle Evans.Ar beName 9784e61219SKyle Evansas the default boot filesystem. 9884e61219SKyle EvansIf the 995952343eSKyle Evans.Op Fl t 1005952343eSKyle Evansflag is given, this takes effect only for the next boot. 101*d81df689SKyle Evans.It Xo 102*d81df689SKyle Evans.Cm create 1035952343eSKyle Evans.Op Fl r 104*d81df689SKyle Evans.Op Fl e Brq Ar nonActiveBe | beName@snapshot 105*d81df689SKyle Evans.Ar beName 106*d81df689SKyle Evans.Xc 1075952343eSKyle EvansCreates a new boot environment named 1085952343eSKyle Evans.Ar beName . 1095952343eSKyle EvansIf the 110*d81df689SKyle Evans.Fl e 111*d81df689SKyle Evansargument is specified, the new environment will be cloned from the given 112*d81df689SKyle Evans.Brq Ar nonActiveBe | Ar beName@snapshot . 113*d81df689SKyle EvansIf the 114*d81df689SKyle Evans.Fl r 1155952343eSKyle Evansflag is given, a recursive boot environment will be made. 116*d81df689SKyle Evans.It Xo 117*d81df689SKyle Evans.Cm create 1185952343eSKyle Evans.Op Fl r 119*d81df689SKyle Evans.Ar beName@snapshot 120*d81df689SKyle Evans.Xc 1215952343eSKyle EvansCreates a snapshot of the existing boot environment named 1225952343eSKyle Evans.Ar beName . 1235952343eSKyle EvansIf the 124*d81df689SKyle Evans.Fl r 1255952343eSKyle Evansflag is given, a recursive boot environment will be made. 126*d81df689SKyle Evans.It Xo 127*d81df689SKyle Evans.Cm destroy 1285952343eSKyle Evans.Op Fl F 129*d81df689SKyle Evans.Brq Ar beName | beName@snapshot 130*d81df689SKyle Evans.Xc 1315952343eSKyle EvansDestroys the given 1325952343eSKyle Evans.Ar beName 1335952343eSKyle Evansboot environment or 1345952343eSKyle Evans.Ar beName@snapshot 1355952343eSKyle Evanssnapshot. 1365952343eSKyle EvansSpecifying 1375952343eSKyle Evans.Fl F 1385952343eSKyle Evanswill automatically unmount without confirmation. 139*d81df689SKyle Evans.It Cm export Ar sourceBe 14034761e84SKyle EvansExport 14134761e84SKyle Evans.Ar sourceBe 14234761e84SKyle Evansto 14334761e84SKyle Evans.Dv stdout . 14434761e84SKyle Evans.Dv stdout 14534761e84SKyle Evansmust be piped or redirected to a file. 146*d81df689SKyle Evans.It Cm import Ar targetBe 14734761e84SKyle EvansImport 14834761e84SKyle Evans.Ar targetBe 14934761e84SKyle Evansfrom 15034761e84SKyle Evans.Dv stdin . 151*d81df689SKyle Evans.It Xo 152*d81df689SKyle Evans.Cm jail 153*d81df689SKyle Evans.Brq Fl b | Fl U 154*d81df689SKyle Evans.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... 155*d81df689SKyle Evans.Brq Ar jailID | jailName 1565952343eSKyle Evans.Ao Ar bootenv Ac 157cd816834SKyle Evans.Op Ar utility Op Ar argument ... 158*d81df689SKyle Evans.Xc 1595952343eSKyle EvansCreates a jail of the given boot environment. 160d694059fSKyle EvansMultiple 161d694059fSKyle Evans.Fl o 1622a0b8dc2SKyle Evansand 1632a0b8dc2SKyle Evans.Fl u 164d694059fSKyle Evansarguments may be specified. 1652a0b8dc2SKyle Evans.Fl o 1662a0b8dc2SKyle Evanswill set a jail parameter, and 1672a0b8dc2SKyle Evans.Fl u 1682a0b8dc2SKyle Evanswill unset a jail parameter. 169cd816834SKyle Evans.Pp 170cd816834SKyle EvansBy default, jails are created in interactive mode and 171cd816834SKyle Evans.Pa /bin/sh 172cd816834SKyle Evansis 173b509cad4SKyle Evansexecuted within the jail. 174cd816834SKyle EvansIf 175cd816834SKyle Evans.Ar utility 176cd816834SKyle Evansis specified, it will be executed instead of 177cd816834SKyle Evans.Pa /bin/sh . 178db9db0e7SKyle EvansThe jail will be destroyed and the boot environment unmounted when the command 179db9db0e7SKyle Evansfinishes executing, unless the 180db9db0e7SKyle Evans.Fl U 181db9db0e7SKyle Evansargument is specified. 182cd816834SKyle Evans.Pp 183b509cad4SKyle EvansThe 184b509cad4SKyle Evans.Fl b 185b509cad4SKyle Evansargument enables batch mode, thereby disabling interactive mode. 186db9db0e7SKyle EvansThe 187db9db0e7SKyle Evans.Fl U 188db9db0e7SKyle Evansargument will be ignored in batch mode. 1892a0b8dc2SKyle Evans.Pp 1902a0b8dc2SKyle EvansThe 1912a0b8dc2SKyle Evans.Va name , 1922a0b8dc2SKyle Evans.Va host.hostname , 1932a0b8dc2SKyle Evansand 1942a0b8dc2SKyle Evans.Va path 1952a0b8dc2SKyle Evansmay not actually be unset. 1962a0b8dc2SKyle EvansAttempts to unset any of these will revert them to the default values specified 1972a0b8dc2SKyle Evansbelow, if they have been overwritten by 1982a0b8dc2SKyle Evans.Fl o . 1992a0b8dc2SKyle Evans.Pp 2002a0b8dc2SKyle EvansAll 201*d81df689SKyle Evans.Ar key Ns = Ns Ar value 202d694059fSKyle Evanspairs are interpreted as jail parameters as described in 203d694059fSKyle Evans.Xr jail 8 . 204d694059fSKyle EvansThe following default parameters are provided: 205*d81df689SKyle Evans.Bl -column "allow.mount.devfs" "" 206*d81df689SKyle Evans.It Va allow.mount Ta Cm true 207*d81df689SKyle Evans.It Va allow.mount.devfs Ta Cm true 208*d81df689SKyle Evans.It Va enforce_statfs Ta Cm 1 209*d81df689SKyle Evans.It Va name Ta Va bootenv 210*d81df689SKyle Evans.It Va host.hostname Ta Va bootenv 211*d81df689SKyle Evans.It Va path Ta Set to a path in /tmp generated by 21284e61219SKyle Evans.Xr libbe 3 . 213d694059fSKyle Evans.El 2145952343eSKyle Evans.Pp 2152a0b8dc2SKyle EvansAll default parameters may be overwritten. 216*d81df689SKyle Evans.It Cm list Op Fl DHas 2175952343eSKyle EvansDisplays all boot environments. 218*d81df689SKyle EvansThe Active field indicates whether the boot environment is active now (N); 219*d81df689SKyle Evansactive on reboot (R); or both (NR). 2205952343eSKyle Evans.Pp 2215952343eSKyle EvansIf 2225952343eSKyle Evans.Fl a 2235952343eSKyle Evansis used, display all datasets. 2245952343eSKyle EvansIf 2255952343eSKyle Evans.Fl D 226*d81df689SKyle Evansis used, display the full space usage for each boot environment, assuming all 227*d81df689SKyle Evansother boot environments were destroyed. 2285952343eSKyle EvansThe 2295952343eSKyle Evans.Fl H 23084e61219SKyle Evansoption is used for scripting. 231*d81df689SKyle EvansIt does not print headers and separate fields by a single tab instead of 232*d81df689SKyle Evansarbitrary white space. 2335952343eSKyle EvansIf 2345952343eSKyle Evans.Fl s 2355952343eSKyle Evansis used, display all snapshots as well. 236*d81df689SKyle Evans.It Cm mount Ar beName Op Ar mountpoint 2375952343eSKyle EvansTemporarily mount the boot environment. 2385952343eSKyle EvansMount at the specified 2395952343eSKyle Evans.Ar mountpoint 2405952343eSKyle Evansif provided. 241*d81df689SKyle Evans.It Cm rename Ar origBeName newBeName 2425952343eSKyle EvansRenames the given nonactive 2435952343eSKyle Evans.Ar origBeName 2445952343eSKyle Evansto the given 245*d81df689SKyle Evans.Ar newBeName . 246*d81df689SKyle Evans.It Cm unjail Brq Ar jailID | jailName | beName 247216d4359SKyle EvansDestroys the jail created from the given boot environment. 248*d81df689SKyle Evans.It Xo 249*d81df689SKyle Evans.Cm unmount 2505952343eSKyle Evans.Op Fl f 251*d81df689SKyle Evans.Ar beName 252*d81df689SKyle Evans.Xc 2535952343eSKyle EvansUnmount the given boot environment, if it is mounted. 2545952343eSKyle EvansSpecifying 2555952343eSKyle Evans.Fl f 2565952343eSKyle Evanswill force the unmount if busy. 2575952343eSKyle Evans.El 2585952343eSKyle Evans.Sh EXAMPLES 2595952343eSKyle Evans.Bl -bullet 2605952343eSKyle Evans.It 2615952343eSKyle EvansTo fill in with jail upgrade example when behavior is firm. 26284e61219SKyle Evans.El 2635952343eSKyle Evans.Sh SEE ALSO 2645952343eSKyle Evans.Xr jail 8 , 2655952343eSKyle Evans.Xr zfs 8 , 2665952343eSKyle Evans.Xr zpool 8 2675952343eSKyle Evans.Sh HISTORY 2685952343eSKyle Evans.Nm 2695952343eSKyle Evansis based on 270*d81df689SKyle Evans.Nm beadm 2715952343eSKyle Evansand was implemented as a project for the 2017 Summer of Code, along with 2725952343eSKyle Evans.Xr libbe 3 . 2735952343eSKyle Evans.Sh AUTHORS 274*d81df689SKyle Evans.Nm 275*d81df689SKyle Evanswas written by 276*d81df689SKyle Evans.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in . 2775952343eSKyle Evans.Pp 278*d81df689SKyle Evans.Nm beadm 279*d81df689SKyle Evanswas written and is maintained by 280*d81df689SKyle Evans.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl . 2815952343eSKyle Evans.Pp 28234761e84SKyle Evans.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net 283*d81df689SKyle Evanswrote the original 284*d81df689SKyle Evans.Nm beadm 2855952343eSKyle Evansmanual page that this one is derived from. 286