xref: /freebsd/sbin/bectl/bectl.8 (revision 28f4385e45a2681c14bd04b83fe1796eaefe8265)
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 December 25, 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.Ar bootenv
56.Op Ar utility Op Ar argument ...
57.Nm
58.Cm list
59.Op Fl DHas
60.Nm
61.Cm mount
62.Ar beName
63.Op mountpoint
64.Nm
65.Cm rename
66.Ar origBeName
67.Ar newBeName
68.Nm
69.Brq Cm ujail | unjail
70.Brq Ar jailID | jailName
71.Ar bootenv
72.Nm
73.Brq Cm umount | unmount
74.Op Fl f
75.Ar beName
76.Sh DESCRIPTION
77The
78.Nm
79command is used to setup and interact with ZFS boot environments, which are
80bootable clones of datasets.
81.Pp
82.Em Boot Environments
83allows the system to be upgraded, while preserving the old system environment in
84a separate ZFS dataset.
85.Sh COMMANDS
86The following commands are supported by
87.Nm :
88.Bl -tag -width activate
89.It Xo
90.Cm activate
91.Op Fl t
92.Ar beName
93.Xc
94Activate the given
95.Ar beName
96as the default boot filesystem.
97If the
98.Op Fl t
99flag is given, this takes effect only for the next boot.
100.It Xo
101.Cm create
102.Op Fl r
103.Op Fl e Brq Ar nonActiveBe | beName@snapshot
104.Ar beName
105.Xc
106Creates a new boot environment named
107.Ar beName .
108If the
109.Fl e
110argument is specified, the new environment will be cloned from the given
111.Brq Ar nonActiveBe | Ar beName@snapshot .
112If the
113.Fl r
114flag is given, a recursive boot environment will be made.
115.It Xo
116.Cm create
117.Op Fl r
118.Ar beName@snapshot
119.Xc
120Creates a snapshot of the existing boot environment named
121.Ar beName .
122If the
123.Fl r
124flag is given, a recursive boot environment will be made.
125.It Xo
126.Cm destroy
127.Op Fl F
128.Brq Ar beName | beName@snapshot
129.Xc
130Destroys the given
131.Ar beName
132boot environment or
133.Ar beName@snapshot
134snapshot without confirmation, unlike in
135.Nm beadm .
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.Ao Ar bootenv Ac
156.Op Ar utility Op Ar argument ...
157.Xc
158Creates a jail of the given boot environment.
159Multiple
160.Fl o
161and
162.Fl u
163arguments may be specified.
164.Fl o
165will set a jail parameter, and
166.Fl u
167will unset a jail parameter.
168.Pp
169By default, jails are created in interactive mode and
170.Pa /bin/sh
171is
172executed within the jail.
173If
174.Ar utility
175is specified, it will be executed instead of
176.Pa /bin/sh .
177The jail will be destroyed and the boot environment unmounted when the command
178finishes executing, unless the
179.Fl U
180argument is specified.
181.Pp
182The
183.Fl b
184argument enables batch mode, thereby disabling interactive mode.
185The
186.Fl U
187argument will be ignored in batch mode.
188.Pp
189The
190.Va name ,
191.Va host.hostname ,
192and
193.Va path
194must be set, the default values are specified below.
195.Pp
196All
197.Ar key Ns = Ns Ar value
198pairs are interpreted as jail parameters as described in
199.Xr jail 8 .
200The following default parameters are provided:
201.Bl -column "allow.mount.devfs" ""
202.It Va allow.mount Ta Cm true
203.It Va allow.mount.devfs Ta Cm true
204.It Va enforce_statfs Ta Cm 1
205.It Va name Ta jail id
206.It Va host.hostname Ta Va bootenv
207.It Va path Ta Set to a path in /tmp generated by
208.Xr libbe 3 .
209.El
210.Pp
211All default parameters may be overwritten.
212.It Cm list Op Fl DHas
213Displays all boot environments.
214The Active field indicates whether the boot environment is active now (N);
215active on reboot (R); or both (NR).
216.Pp
217If
218.Fl a
219is used, display all datasets.
220If
221.Fl D
222is used, display the full space usage for each boot environment, assuming all
223other boot environments were destroyed.
224The
225.Fl H
226option is used for scripting.
227It does not print headers and separate fields by a single tab instead of
228arbitrary white space.
229If
230.Fl s
231is used, display all snapshots as well.
232.It Cm mount Ar beName Op Ar mountpoint
233Temporarily mount the boot environment.
234Mount at the specified
235.Ar mountpoint
236if provided.
237.It Cm rename Ar origBeName newBeName
238Renames the given
239.Ar origBeName
240to the given
241.Ar newBeName .
242The boot environment will not be unmounted in order for this rename to occur.
243.It Cm unjail Brq Ar jailID | jailName | beName
244Destroys the jail created from the given boot environment.
245.It Xo
246.Cm unmount
247.Op Fl f
248.Ar beName
249.Xc
250Unmount the given boot environment, if it is mounted.
251Specifying
252.Fl f
253will force the unmount if busy.
254.El
255.Sh EXAMPLES
256.Bl -bullet
257.It
258To fill in with jail upgrade example when behavior is firm.
259.El
260.Sh SEE ALSO
261.Xr libbe 3 ,
262.Xr jail 8 ,
263.Xr zfs 8 ,
264.Xr zpool 8
265.Sh HISTORY
266.Nm
267is based on
268.Nm beadm
269and was implemented as a project for the 2017 Summer of Code, along with
270.Xr libbe 3 .
271.Sh AUTHORS
272.Nm
273was written by
274.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in .
275.Pp
276.Nm beadm
277was written and is maintained by
278.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl .
279.Pp
280.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net
281wrote the original
282.Nm beadm
283manual page that this one is derived from.
284