xref: /freebsd/sbin/bectl/bectl.8 (revision 7ce09314b2f0611f4fc171b7829bb550a346f3c2)
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*7ce09314SKyle Evans.Dd December 25, 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.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
1275952343eSKyle Evans.Op Fl F
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.
139d81df689SKyle 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.
146d81df689SKyle Evans.It Cm import Ar targetBe
14734761e84SKyle EvansImport
14834761e84SKyle Evans.Ar targetBe
14934761e84SKyle Evansfrom
15034761e84SKyle Evans.Dv stdin .
151d81df689SKyle Evans.It Xo
152d81df689SKyle Evans.Cm jail
153d81df689SKyle Evans.Brq Fl b | Fl U
154d81df689SKyle Evans.Oo Bro Fl o Ar key Ns = Ns Ar value | Fl u Ar key Brc Oc Ns ...
1555952343eSKyle Evans.Ao Ar bootenv Ac
156cd816834SKyle Evans.Op Ar utility Op Ar argument ...
157d81df689SKyle Evans.Xc
1585952343eSKyle EvansCreates a jail of the given boot environment.
159d694059fSKyle EvansMultiple
160d694059fSKyle Evans.Fl o
1612a0b8dc2SKyle Evansand
1622a0b8dc2SKyle Evans.Fl u
163d694059fSKyle Evansarguments may be specified.
1642a0b8dc2SKyle Evans.Fl o
1652a0b8dc2SKyle Evanswill set a jail parameter, and
1662a0b8dc2SKyle Evans.Fl u
1672a0b8dc2SKyle Evanswill unset a jail parameter.
168cd816834SKyle Evans.Pp
169cd816834SKyle EvansBy default, jails are created in interactive mode and
170cd816834SKyle Evans.Pa /bin/sh
171cd816834SKyle Evansis
172b509cad4SKyle Evansexecuted within the jail.
173cd816834SKyle EvansIf
174cd816834SKyle Evans.Ar utility
175cd816834SKyle Evansis specified, it will be executed instead of
176cd816834SKyle Evans.Pa /bin/sh .
177db9db0e7SKyle EvansThe jail will be destroyed and the boot environment unmounted when the command
178db9db0e7SKyle Evansfinishes executing, unless the
179db9db0e7SKyle Evans.Fl U
180db9db0e7SKyle Evansargument is specified.
181cd816834SKyle Evans.Pp
182b509cad4SKyle EvansThe
183b509cad4SKyle Evans.Fl b
184b509cad4SKyle Evansargument enables batch mode, thereby disabling interactive mode.
185db9db0e7SKyle EvansThe
186db9db0e7SKyle Evans.Fl U
187db9db0e7SKyle Evansargument will be ignored in batch mode.
1882a0b8dc2SKyle Evans.Pp
1892a0b8dc2SKyle EvansThe
1902a0b8dc2SKyle Evans.Va name ,
1912a0b8dc2SKyle Evans.Va host.hostname ,
1922a0b8dc2SKyle Evansand
1932a0b8dc2SKyle Evans.Va path
194*7ce09314SKyle Evansmust be set, the default values are specified below.
1952a0b8dc2SKyle Evans.Pp
1962a0b8dc2SKyle EvansAll
197d81df689SKyle Evans.Ar key Ns = Ns Ar value
198d694059fSKyle Evanspairs are interpreted as jail parameters as described in
199d694059fSKyle Evans.Xr jail 8 .
200d694059fSKyle EvansThe following default parameters are provided:
201d81df689SKyle Evans.Bl -column "allow.mount.devfs" ""
202d81df689SKyle Evans.It Va allow.mount Ta Cm true
203d81df689SKyle Evans.It Va allow.mount.devfs Ta Cm true
204d81df689SKyle Evans.It Va enforce_statfs Ta Cm 1
205*7ce09314SKyle Evans.It Va name Ta jail id
206d81df689SKyle Evans.It Va host.hostname Ta Va bootenv
207d81df689SKyle Evans.It Va path Ta Set to a path in /tmp generated by
20884e61219SKyle Evans.Xr libbe 3 .
209d694059fSKyle Evans.El
2105952343eSKyle Evans.Pp
2112a0b8dc2SKyle EvansAll default parameters may be overwritten.
212d81df689SKyle Evans.It Cm list Op Fl DHas
2135952343eSKyle EvansDisplays all boot environments.
214d81df689SKyle EvansThe Active field indicates whether the boot environment is active now (N);
215d81df689SKyle Evansactive on reboot (R); or both (NR).
2165952343eSKyle Evans.Pp
2175952343eSKyle EvansIf
2185952343eSKyle Evans.Fl a
2195952343eSKyle Evansis used, display all datasets.
2205952343eSKyle EvansIf
2215952343eSKyle Evans.Fl D
222d81df689SKyle Evansis used, display the full space usage for each boot environment, assuming all
223d81df689SKyle Evansother boot environments were destroyed.
2245952343eSKyle EvansThe
2255952343eSKyle Evans.Fl H
22684e61219SKyle Evansoption is used for scripting.
227d81df689SKyle EvansIt does not print headers and separate fields by a single tab instead of
228d81df689SKyle Evansarbitrary white space.
2295952343eSKyle EvansIf
2305952343eSKyle Evans.Fl s
2315952343eSKyle Evansis used, display all snapshots as well.
232d81df689SKyle Evans.It Cm mount Ar beName Op Ar mountpoint
2335952343eSKyle EvansTemporarily mount the boot environment.
2345952343eSKyle EvansMount at the specified
2355952343eSKyle Evans.Ar mountpoint
2365952343eSKyle Evansif provided.
237d81df689SKyle Evans.It Cm rename Ar origBeName newBeName
2388369ba42SKyle EvansRenames the given
2395952343eSKyle Evans.Ar origBeName
2405952343eSKyle Evansto the given
241d81df689SKyle Evans.Ar newBeName .
2428369ba42SKyle EvansThe boot environment will not be unmounted in order for this rename to occur.
243d81df689SKyle Evans.It Cm unjail Brq Ar jailID | jailName | beName
244216d4359SKyle EvansDestroys the jail created from the given boot environment.
245d81df689SKyle Evans.It Xo
246d81df689SKyle Evans.Cm unmount
2475952343eSKyle Evans.Op Fl f
248d81df689SKyle Evans.Ar beName
249d81df689SKyle Evans.Xc
2505952343eSKyle EvansUnmount the given boot environment, if it is mounted.
2515952343eSKyle EvansSpecifying
2525952343eSKyle Evans.Fl f
2535952343eSKyle Evanswill force the unmount if busy.
2545952343eSKyle Evans.El
2555952343eSKyle Evans.Sh EXAMPLES
2565952343eSKyle Evans.Bl -bullet
2575952343eSKyle Evans.It
2585952343eSKyle EvansTo fill in with jail upgrade example when behavior is firm.
25984e61219SKyle Evans.El
2605952343eSKyle Evans.Sh SEE ALSO
261f5c8cb4cSMateusz Piotrowski.Xr libbe 3 ,
2625952343eSKyle Evans.Xr jail 8 ,
2635952343eSKyle Evans.Xr zfs 8 ,
2645952343eSKyle Evans.Xr zpool 8
2655952343eSKyle Evans.Sh HISTORY
2665952343eSKyle Evans.Nm
2675952343eSKyle Evansis based on
268d81df689SKyle Evans.Nm beadm
2695952343eSKyle Evansand was implemented as a project for the 2017 Summer of Code, along with
2705952343eSKyle Evans.Xr libbe 3 .
2715952343eSKyle Evans.Sh AUTHORS
272d81df689SKyle Evans.Nm
273d81df689SKyle Evanswas written by
274d81df689SKyle Evans.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in .
2755952343eSKyle Evans.Pp
276d81df689SKyle Evans.Nm beadm
277d81df689SKyle Evanswas written and is maintained by
278d81df689SKyle Evans.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl .
2795952343eSKyle Evans.Pp
28034761e84SKyle Evans.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net
281d81df689SKyle Evanswrote the original
282d81df689SKyle Evans.Nm beadm
2835952343eSKyle Evansmanual page that this one is derived from.
284