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.\" 21*8369ba42SKyle Evans.Dd August 24, 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 29d81df689SKyle Evans.Cm activate 305952343eSKyle Evans.Op Fl t 31d81df689SKyle Evans.Ar beName 325952343eSKyle Evans.Nm 33d81df689SKyle Evans.Cm create 345952343eSKyle Evans.Op Fl r 35d81df689SKyle Evans.Op Fl e Brq Ar nonActiveBe | beName@snapshot 36d81df689SKyle Evans.Ar beName 375952343eSKyle Evans.Nm 38d81df689SKyle Evans.Cm create 395952343eSKyle Evans.Op Fl r 40d81df689SKyle Evans.Ar beName@snapshot 415952343eSKyle Evans.Nm 42d81df689SKyle Evans.Cm destroy 435952343eSKyle Evans.Op Fl F 44d81df689SKyle Evans.Brq Ar beName | beName@snapshot 455952343eSKyle Evans.Nm 46d81df689SKyle Evans.Cm export 47d81df689SKyle Evans.Ar sourceBe 4834761e84SKyle Evans.Nm 49d81df689SKyle Evans.Cm import 50d81df689SKyle Evans.Ar targetBe 5134761e84SKyle Evans.Nm 52d81df689SKyle Evans.Cm jail 53d81df689SKyle Evans.Brq Fl b | Fl U 54d81df689SKyle Evans.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... 55d81df689SKyle Evans.Brq Ar jailID | jailName 56d81df689SKyle Evans.Ar bootenv 57cd816834SKyle Evans.Op Ar utility Op Ar argument ... 585952343eSKyle Evans.Nm 59d81df689SKyle Evans.Cm list 60d81df689SKyle Evans.Op Fl DHas 615952343eSKyle Evans.Nm 62d81df689SKyle Evans.Cm mount 63d81df689SKyle Evans.Ar beName 645952343eSKyle Evans.Op mountpoint 655952343eSKyle Evans.Nm 66d81df689SKyle Evans.Cm rename 67d81df689SKyle Evans.Ar origBeName 68d81df689SKyle Evans.Ar newBeName 695952343eSKyle Evans.Nm 70d81df689SKyle Evans.Brq Cm ujail | unjail 71d81df689SKyle Evans.Brq Ar jailID | jailName 72d81df689SKyle Evans.Ar bootenv 735952343eSKyle Evans.Nm 74d81df689SKyle Evans.Brq Cm umount | unmount 755952343eSKyle Evans.Op Fl f 76d81df689SKyle Evans.Ar beName 775952343eSKyle Evans.Sh DESCRIPTION 785952343eSKyle EvansThe 795952343eSKyle Evans.Nm 80d81df689SKyle Evanscommand is used to setup and interact with ZFS boot environments, which are 81d81df689SKyle Evansbootable clones of datasets. 825952343eSKyle Evans.Pp 835952343eSKyle Evans.Em Boot Environments 84d81df689SKyle Evansallows the system to be upgraded, while preserving the old system environment in 85d81df689SKyle Evansa separate ZFS dataset. 865952343eSKyle Evans.Sh COMMANDS 875952343eSKyle EvansThe following commands are supported by 885952343eSKyle Evans.Nm : 895952343eSKyle Evans.Bl -tag -width activate 90d81df689SKyle Evans.It Xo 91d81df689SKyle Evans.Cm activate 925952343eSKyle Evans.Op Fl t 93d81df689SKyle Evans.Ar beName 94d81df689SKyle 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. 101d81df689SKyle Evans.It Xo 102d81df689SKyle Evans.Cm create 1035952343eSKyle Evans.Op Fl r 104d81df689SKyle Evans.Op Fl e Brq Ar nonActiveBe | beName@snapshot 105d81df689SKyle Evans.Ar beName 106d81df689SKyle Evans.Xc 1075952343eSKyle EvansCreates a new boot environment named 1085952343eSKyle Evans.Ar beName . 1095952343eSKyle EvansIf the 110d81df689SKyle Evans.Fl e 111d81df689SKyle Evansargument is specified, the new environment will be cloned from the given 112d81df689SKyle Evans.Brq Ar nonActiveBe | Ar beName@snapshot . 113d81df689SKyle EvansIf the 114d81df689SKyle Evans.Fl r 1155952343eSKyle Evansflag is given, a recursive boot environment will be made. 116d81df689SKyle Evans.It Xo 117d81df689SKyle Evans.Cm create 1185952343eSKyle Evans.Op Fl r 119d81df689SKyle Evans.Ar beName@snapshot 120d81df689SKyle Evans.Xc 1215952343eSKyle EvansCreates a snapshot of the existing boot environment named 1225952343eSKyle Evans.Ar beName . 1235952343eSKyle EvansIf the 124d81df689SKyle Evans.Fl r 1255952343eSKyle Evansflag is given, a recursive boot environment will be made. 126d81df689SKyle Evans.It Xo 127d81df689SKyle Evans.Cm destroy 1285952343eSKyle Evans.Op Fl F 129d81df689SKyle Evans.Brq Ar beName | beName@snapshot 130d81df689SKyle Evans.Xc 1315952343eSKyle EvansDestroys the given 1325952343eSKyle Evans.Ar beName 1335952343eSKyle Evansboot environment or 1345952343eSKyle Evans.Ar beName@snapshot 135*8369ba42SKyle Evanssnapshot without confirmation, unlike in 136*8369ba42SKyle Evans.Nm beadm . 1375952343eSKyle EvansSpecifying 1385952343eSKyle Evans.Fl F 1395952343eSKyle Evanswill automatically unmount without confirmation. 140d81df689SKyle Evans.It Cm export Ar sourceBe 14134761e84SKyle EvansExport 14234761e84SKyle Evans.Ar sourceBe 14334761e84SKyle Evansto 14434761e84SKyle Evans.Dv stdout . 14534761e84SKyle Evans.Dv stdout 14634761e84SKyle Evansmust be piped or redirected to a file. 147d81df689SKyle Evans.It Cm import Ar targetBe 14834761e84SKyle EvansImport 14934761e84SKyle Evans.Ar targetBe 15034761e84SKyle Evansfrom 15134761e84SKyle Evans.Dv stdin . 152d81df689SKyle Evans.It Xo 153d81df689SKyle Evans.Cm jail 154d81df689SKyle Evans.Brq Fl b | Fl U 155d81df689SKyle Evans.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ... 156d81df689SKyle Evans.Brq Ar jailID | jailName 1575952343eSKyle Evans.Ao Ar bootenv Ac 158cd816834SKyle Evans.Op Ar utility Op Ar argument ... 159d81df689SKyle Evans.Xc 1605952343eSKyle EvansCreates a jail of the given boot environment. 161d694059fSKyle EvansMultiple 162d694059fSKyle Evans.Fl o 1632a0b8dc2SKyle Evansand 1642a0b8dc2SKyle Evans.Fl u 165d694059fSKyle Evansarguments may be specified. 1662a0b8dc2SKyle Evans.Fl o 1672a0b8dc2SKyle Evanswill set a jail parameter, and 1682a0b8dc2SKyle Evans.Fl u 1692a0b8dc2SKyle Evanswill unset a jail parameter. 170cd816834SKyle Evans.Pp 171cd816834SKyle EvansBy default, jails are created in interactive mode and 172cd816834SKyle Evans.Pa /bin/sh 173cd816834SKyle Evansis 174b509cad4SKyle Evansexecuted within the jail. 175cd816834SKyle EvansIf 176cd816834SKyle Evans.Ar utility 177cd816834SKyle Evansis specified, it will be executed instead of 178cd816834SKyle Evans.Pa /bin/sh . 179db9db0e7SKyle EvansThe jail will be destroyed and the boot environment unmounted when the command 180db9db0e7SKyle Evansfinishes executing, unless the 181db9db0e7SKyle Evans.Fl U 182db9db0e7SKyle Evansargument is specified. 183cd816834SKyle Evans.Pp 184b509cad4SKyle EvansThe 185b509cad4SKyle Evans.Fl b 186b509cad4SKyle Evansargument enables batch mode, thereby disabling interactive mode. 187db9db0e7SKyle EvansThe 188db9db0e7SKyle Evans.Fl U 189db9db0e7SKyle Evansargument will be ignored in batch mode. 1902a0b8dc2SKyle Evans.Pp 1912a0b8dc2SKyle EvansThe 1922a0b8dc2SKyle Evans.Va name , 1932a0b8dc2SKyle Evans.Va host.hostname , 1942a0b8dc2SKyle Evansand 1952a0b8dc2SKyle Evans.Va path 1962a0b8dc2SKyle Evansmay not actually be unset. 1972a0b8dc2SKyle EvansAttempts to unset any of these will revert them to the default values specified 1982a0b8dc2SKyle Evansbelow, if they have been overwritten by 1992a0b8dc2SKyle Evans.Fl o . 2002a0b8dc2SKyle Evans.Pp 2012a0b8dc2SKyle EvansAll 202d81df689SKyle Evans.Ar key Ns = Ns Ar value 203d694059fSKyle Evanspairs are interpreted as jail parameters as described in 204d694059fSKyle Evans.Xr jail 8 . 205d694059fSKyle EvansThe following default parameters are provided: 206d81df689SKyle Evans.Bl -column "allow.mount.devfs" "" 207d81df689SKyle Evans.It Va allow.mount Ta Cm true 208d81df689SKyle Evans.It Va allow.mount.devfs Ta Cm true 209d81df689SKyle Evans.It Va enforce_statfs Ta Cm 1 210d81df689SKyle Evans.It Va name Ta Va bootenv 211d81df689SKyle Evans.It Va host.hostname Ta Va bootenv 212d81df689SKyle Evans.It Va path Ta Set to a path in /tmp generated by 21384e61219SKyle Evans.Xr libbe 3 . 214d694059fSKyle Evans.El 2155952343eSKyle Evans.Pp 2162a0b8dc2SKyle EvansAll default parameters may be overwritten. 217d81df689SKyle Evans.It Cm list Op Fl DHas 2185952343eSKyle EvansDisplays all boot environments. 219d81df689SKyle EvansThe Active field indicates whether the boot environment is active now (N); 220d81df689SKyle Evansactive on reboot (R); or both (NR). 2215952343eSKyle Evans.Pp 2225952343eSKyle EvansIf 2235952343eSKyle Evans.Fl a 2245952343eSKyle Evansis used, display all datasets. 2255952343eSKyle EvansIf 2265952343eSKyle Evans.Fl D 227d81df689SKyle Evansis used, display the full space usage for each boot environment, assuming all 228d81df689SKyle Evansother boot environments were destroyed. 2295952343eSKyle EvansThe 2305952343eSKyle Evans.Fl H 23184e61219SKyle Evansoption is used for scripting. 232d81df689SKyle EvansIt does not print headers and separate fields by a single tab instead of 233d81df689SKyle Evansarbitrary white space. 2345952343eSKyle EvansIf 2355952343eSKyle Evans.Fl s 2365952343eSKyle Evansis used, display all snapshots as well. 237d81df689SKyle Evans.It Cm mount Ar beName Op Ar mountpoint 2385952343eSKyle EvansTemporarily mount the boot environment. 2395952343eSKyle EvansMount at the specified 2405952343eSKyle Evans.Ar mountpoint 2415952343eSKyle Evansif provided. 242d81df689SKyle Evans.It Cm rename Ar origBeName newBeName 243*8369ba42SKyle EvansRenames the given 2445952343eSKyle Evans.Ar origBeName 2455952343eSKyle Evansto the given 246d81df689SKyle Evans.Ar newBeName . 247*8369ba42SKyle EvansThe boot environment will not be unmounted in order for this rename to occur. 248d81df689SKyle Evans.It Cm unjail Brq Ar jailID | jailName | beName 249216d4359SKyle EvansDestroys the jail created from the given boot environment. 250d81df689SKyle Evans.It Xo 251d81df689SKyle Evans.Cm unmount 2525952343eSKyle Evans.Op Fl f 253d81df689SKyle Evans.Ar beName 254d81df689SKyle Evans.Xc 2555952343eSKyle EvansUnmount the given boot environment, if it is mounted. 2565952343eSKyle EvansSpecifying 2575952343eSKyle Evans.Fl f 2585952343eSKyle Evanswill force the unmount if busy. 2595952343eSKyle Evans.El 2605952343eSKyle Evans.Sh EXAMPLES 2615952343eSKyle Evans.Bl -bullet 2625952343eSKyle Evans.It 2635952343eSKyle EvansTo fill in with jail upgrade example when behavior is firm. 26484e61219SKyle Evans.El 2655952343eSKyle Evans.Sh SEE ALSO 2665952343eSKyle Evans.Xr jail 8 , 2675952343eSKyle Evans.Xr zfs 8 , 2685952343eSKyle Evans.Xr zpool 8 2695952343eSKyle Evans.Sh HISTORY 2705952343eSKyle Evans.Nm 2715952343eSKyle Evansis based on 272d81df689SKyle Evans.Nm beadm 2735952343eSKyle Evansand was implemented as a project for the 2017 Summer of Code, along with 2745952343eSKyle Evans.Xr libbe 3 . 2755952343eSKyle Evans.Sh AUTHORS 276d81df689SKyle Evans.Nm 277d81df689SKyle Evanswas written by 278d81df689SKyle Evans.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in . 2795952343eSKyle Evans.Pp 280d81df689SKyle Evans.Nm beadm 281d81df689SKyle Evanswas written and is maintained by 282d81df689SKyle Evans.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl . 2835952343eSKyle Evans.Pp 28434761e84SKyle Evans.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net 285d81df689SKyle Evanswrote the original 286d81df689SKyle Evans.Nm beadm 2875952343eSKyle Evansmanual page that this one is derived from. 288