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