xref: /freebsd/sbin/bectl/bectl.8 (revision 77b4126ce6f389b135bbad48574923a1264e31fa)
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*77b4126cSKyle Evans.Dd February 10, 2019
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
43*77b4126cSKyle Evans.Op Fl \&Fo
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.Ar bootenv
56cd816834SKyle Evans.Op Ar utility Op Ar argument ...
575952343eSKyle Evans.Nm
58d81df689SKyle Evans.Cm list
59d81df689SKyle Evans.Op Fl DHas
605952343eSKyle Evans.Nm
61d81df689SKyle Evans.Cm mount
62d81df689SKyle Evans.Ar beName
635952343eSKyle Evans.Op mountpoint
645952343eSKyle Evans.Nm
65d81df689SKyle Evans.Cm rename
66d81df689SKyle Evans.Ar origBeName
67d81df689SKyle Evans.Ar newBeName
685952343eSKyle Evans.Nm
69d81df689SKyle Evans.Brq Cm ujail | unjail
70d81df689SKyle Evans.Brq Ar jailID | jailName
71d81df689SKyle Evans.Ar bootenv
725952343eSKyle Evans.Nm
73d81df689SKyle Evans.Brq Cm umount | unmount
745952343eSKyle Evans.Op Fl f
75d81df689SKyle Evans.Ar beName
765952343eSKyle Evans.Sh DESCRIPTION
775952343eSKyle EvansThe
785952343eSKyle Evans.Nm
79d81df689SKyle Evanscommand is used to setup and interact with ZFS boot environments, which are
80d81df689SKyle Evansbootable clones of datasets.
815952343eSKyle Evans.Pp
825952343eSKyle Evans.Em Boot Environments
83d81df689SKyle Evansallows the system to be upgraded, while preserving the old system environment in
84d81df689SKyle Evansa separate ZFS dataset.
855952343eSKyle Evans.Sh COMMANDS
865952343eSKyle EvansThe following commands are supported by
875952343eSKyle Evans.Nm :
885952343eSKyle Evans.Bl -tag -width activate
89d81df689SKyle Evans.It Xo
90d81df689SKyle Evans.Cm activate
915952343eSKyle Evans.Op Fl t
92d81df689SKyle Evans.Ar beName
93d81df689SKyle Evans.Xc
945952343eSKyle EvansActivate the given
955952343eSKyle Evans.Ar beName
9684e61219SKyle Evansas the default boot filesystem.
9784e61219SKyle EvansIf the
985952343eSKyle Evans.Op Fl t
995952343eSKyle Evansflag is given, this takes effect only for the next boot.
100d81df689SKyle Evans.It Xo
101d81df689SKyle Evans.Cm create
1025952343eSKyle Evans.Op Fl r
103d81df689SKyle Evans.Op Fl e Brq Ar nonActiveBe | beName@snapshot
104d81df689SKyle Evans.Ar beName
105d81df689SKyle Evans.Xc
1065952343eSKyle EvansCreates a new boot environment named
1075952343eSKyle Evans.Ar beName .
1085952343eSKyle EvansIf the
109d81df689SKyle Evans.Fl e
110d81df689SKyle Evansargument is specified, the new environment will be cloned from the given
111d81df689SKyle Evans.Brq Ar nonActiveBe | Ar beName@snapshot .
112d81df689SKyle EvansIf the
113d81df689SKyle Evans.Fl r
1145952343eSKyle Evansflag is given, a recursive boot environment will be made.
115d81df689SKyle Evans.It Xo
116d81df689SKyle Evans.Cm create
1175952343eSKyle Evans.Op Fl r
118d81df689SKyle Evans.Ar beName@snapshot
119d81df689SKyle Evans.Xc
1205952343eSKyle EvansCreates a snapshot of the existing boot environment named
1215952343eSKyle Evans.Ar beName .
1225952343eSKyle EvansIf the
123d81df689SKyle Evans.Fl r
1245952343eSKyle Evansflag is given, a recursive boot environment will be made.
125d81df689SKyle Evans.It Xo
126d81df689SKyle Evans.Cm destroy
127*77b4126cSKyle Evans.Op Fl \&Fo
128d81df689SKyle Evans.Brq Ar beName | beName@snapshot
129d81df689SKyle Evans.Xc
1305952343eSKyle EvansDestroys the given
1315952343eSKyle Evans.Ar beName
1325952343eSKyle Evansboot environment or
1335952343eSKyle Evans.Ar beName@snapshot
1348369ba42SKyle Evanssnapshot without confirmation, unlike in
1358369ba42SKyle Evans.Nm beadm .
1365952343eSKyle EvansSpecifying
1375952343eSKyle Evans.Fl F
1385952343eSKyle Evanswill automatically unmount without confirmation.
139*77b4126cSKyle Evans.Pp
140*77b4126cSKyle EvansBy default,
141*77b4126cSKyle Evans.Nm
142*77b4126cSKyle Evanswill warn that it is not destroying the origin of
143*77b4126cSKyle Evans.Ar beName .
144*77b4126cSKyle EvansThe
145*77b4126cSKyle Evans.Fl o
146*77b4126cSKyle Evansflag may be specified to destroy the origin as well.
147d81df689SKyle Evans.It Cm export Ar sourceBe
14834761e84SKyle EvansExport
14934761e84SKyle Evans.Ar sourceBe
15034761e84SKyle Evansto
15134761e84SKyle Evans.Dv stdout .
15234761e84SKyle Evans.Dv stdout
15334761e84SKyle Evansmust be piped or redirected to a file.
154d81df689SKyle Evans.It Cm import Ar targetBe
15534761e84SKyle EvansImport
15634761e84SKyle Evans.Ar targetBe
15734761e84SKyle Evansfrom
15834761e84SKyle Evans.Dv stdin .
159d81df689SKyle Evans.It Xo
160d81df689SKyle Evans.Cm jail
161d81df689SKyle Evans.Brq Fl b | Fl U
162d81df689SKyle Evans.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ...
1635952343eSKyle Evans.Ao Ar bootenv Ac
164cd816834SKyle Evans.Op Ar utility Op Ar argument ...
165d81df689SKyle Evans.Xc
1665952343eSKyle EvansCreates a jail of the given boot environment.
167d694059fSKyle EvansMultiple
168d694059fSKyle Evans.Fl o
1692a0b8dc2SKyle Evansand
1702a0b8dc2SKyle Evans.Fl u
171d694059fSKyle Evansarguments may be specified.
1722a0b8dc2SKyle Evans.Fl o
1732a0b8dc2SKyle Evanswill set a jail parameter, and
1742a0b8dc2SKyle Evans.Fl u
1752a0b8dc2SKyle Evanswill unset a jail parameter.
176cd816834SKyle Evans.Pp
177cd816834SKyle EvansBy default, jails are created in interactive mode and
178cd816834SKyle Evans.Pa /bin/sh
179cd816834SKyle Evansis
180b509cad4SKyle Evansexecuted within the jail.
181cd816834SKyle EvansIf
182cd816834SKyle Evans.Ar utility
183cd816834SKyle Evansis specified, it will be executed instead of
184cd816834SKyle Evans.Pa /bin/sh .
185db9db0e7SKyle EvansThe jail will be destroyed and the boot environment unmounted when the command
186db9db0e7SKyle Evansfinishes executing, unless the
187db9db0e7SKyle Evans.Fl U
188db9db0e7SKyle Evansargument is specified.
189cd816834SKyle Evans.Pp
190b509cad4SKyle EvansThe
191b509cad4SKyle Evans.Fl b
192b509cad4SKyle Evansargument enables batch mode, thereby disabling interactive mode.
193db9db0e7SKyle EvansThe
194db9db0e7SKyle Evans.Fl U
195db9db0e7SKyle Evansargument will be ignored in batch mode.
1962a0b8dc2SKyle Evans.Pp
1972a0b8dc2SKyle EvansThe
1982a0b8dc2SKyle Evans.Va name ,
1992a0b8dc2SKyle Evans.Va host.hostname ,
2002a0b8dc2SKyle Evansand
2012a0b8dc2SKyle Evans.Va path
2027ce09314SKyle Evansmust be set, the default values are specified below.
2032a0b8dc2SKyle Evans.Pp
2042a0b8dc2SKyle EvansAll
205d81df689SKyle Evans.Ar key Ns = Ns Ar value
206d694059fSKyle Evanspairs are interpreted as jail parameters as described in
207d694059fSKyle Evans.Xr jail 8 .
208d694059fSKyle EvansThe following default parameters are provided:
209d81df689SKyle Evans.Bl -column "allow.mount.devfs" ""
210d81df689SKyle Evans.It Va allow.mount Ta Cm true
211d81df689SKyle Evans.It Va allow.mount.devfs Ta Cm true
212d81df689SKyle Evans.It Va enforce_statfs Ta Cm 1
2137ce09314SKyle Evans.It Va name Ta jail id
214d81df689SKyle Evans.It Va host.hostname Ta Va bootenv
215d81df689SKyle Evans.It Va path Ta Set to a path in /tmp generated by
21684e61219SKyle Evans.Xr libbe 3 .
217d694059fSKyle Evans.El
2185952343eSKyle Evans.Pp
2192a0b8dc2SKyle EvansAll default parameters may be overwritten.
220d81df689SKyle Evans.It Cm list Op Fl DHas
2215952343eSKyle EvansDisplays all boot environments.
222d81df689SKyle EvansThe Active field indicates whether the boot environment is active now (N);
223d81df689SKyle Evansactive on reboot (R); or both (NR).
2245952343eSKyle Evans.Pp
2255952343eSKyle EvansIf
2265952343eSKyle Evans.Fl a
2275952343eSKyle Evansis used, display all datasets.
2285952343eSKyle EvansIf
2295952343eSKyle Evans.Fl D
230d81df689SKyle Evansis used, display the full space usage for each boot environment, assuming all
231d81df689SKyle Evansother boot environments were destroyed.
2325952343eSKyle EvansThe
2335952343eSKyle Evans.Fl H
23484e61219SKyle Evansoption is used for scripting.
235d81df689SKyle EvansIt does not print headers and separate fields by a single tab instead of
236d81df689SKyle Evansarbitrary white space.
2375952343eSKyle EvansIf
2385952343eSKyle Evans.Fl s
2395952343eSKyle Evansis used, display all snapshots as well.
240d81df689SKyle Evans.It Cm mount Ar beName Op Ar mountpoint
2415952343eSKyle EvansTemporarily mount the boot environment.
2425952343eSKyle EvansMount at the specified
2435952343eSKyle Evans.Ar mountpoint
2445952343eSKyle Evansif provided.
245d81df689SKyle Evans.It Cm rename Ar origBeName newBeName
2468369ba42SKyle EvansRenames the given
2475952343eSKyle Evans.Ar origBeName
2485952343eSKyle Evansto the given
249d81df689SKyle Evans.Ar newBeName .
2508369ba42SKyle EvansThe boot environment will not be unmounted in order for this rename to occur.
251d81df689SKyle Evans.It Cm unjail Brq Ar jailID | jailName | beName
252216d4359SKyle EvansDestroys the jail created from the given boot environment.
253d81df689SKyle Evans.It Xo
254d81df689SKyle Evans.Cm unmount
2555952343eSKyle Evans.Op Fl f
256d81df689SKyle Evans.Ar beName
257d81df689SKyle Evans.Xc
2585952343eSKyle EvansUnmount the given boot environment, if it is mounted.
2595952343eSKyle EvansSpecifying
2605952343eSKyle Evans.Fl f
2615952343eSKyle Evanswill force the unmount if busy.
2625952343eSKyle Evans.El
2635952343eSKyle Evans.Sh EXAMPLES
2645952343eSKyle Evans.Bl -bullet
2655952343eSKyle Evans.It
2665952343eSKyle EvansTo fill in with jail upgrade example when behavior is firm.
26784e61219SKyle Evans.El
2685952343eSKyle Evans.Sh SEE ALSO
269f5c8cb4cSMateusz Piotrowski.Xr libbe 3 ,
2705952343eSKyle Evans.Xr jail 8 ,
2715952343eSKyle Evans.Xr zfs 8 ,
2725952343eSKyle Evans.Xr zpool 8
2735952343eSKyle Evans.Sh HISTORY
2745952343eSKyle Evans.Nm
2755952343eSKyle Evansis based on
276d81df689SKyle Evans.Nm beadm
2775952343eSKyle Evansand was implemented as a project for the 2017 Summer of Code, along with
2785952343eSKyle Evans.Xr libbe 3 .
2795952343eSKyle Evans.Sh AUTHORS
280d81df689SKyle Evans.Nm
281d81df689SKyle Evanswas written by
282d81df689SKyle Evans.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in .
2835952343eSKyle Evans.Pp
284d81df689SKyle Evans.Nm beadm
285d81df689SKyle Evanswas written and is maintained by
286d81df689SKyle Evans.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl .
2875952343eSKyle Evans.Pp
28834761e84SKyle Evans.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net
289d81df689SKyle Evanswrote the original
290d81df689SKyle Evans.Nm beadm
2915952343eSKyle Evansmanual page that this one is derived from.
292