]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/bectl/bectl.8
Merge compiler-rt trunk r351319, and resolve conflicts.
[FreeBSD/FreeBSD.git] / sbin / bectl / bectl.8
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
77 The
78 .Nm
79 command is used to setup and interact with ZFS boot environments, which are
80 bootable clones of datasets.
81 .Pp
82 .Em Boot Environments
83 allows the system to be upgraded, while preserving the old system environment in
84 a separate ZFS dataset.
85 .Sh COMMANDS
86 The 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
94 Activate the given
95 .Ar beName
96 as the default boot filesystem.
97 If the
98 .Op Fl t
99 flag 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
106 Creates a new boot environment named
107 .Ar beName .
108 If the
109 .Fl e
110 argument is specified, the new environment will be cloned from the given
111 .Brq Ar nonActiveBe | Ar beName@snapshot .
112 If the
113 .Fl r
114 flag 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
120 Creates a snapshot of the existing boot environment named
121 .Ar beName .
122 If the
123 .Fl r
124 flag 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
130 Destroys the given
131 .Ar beName
132 boot environment or
133 .Ar beName@snapshot
134 snapshot without confirmation, unlike in
135 .Nm beadm .
136 Specifying
137 .Fl F
138 will automatically unmount without confirmation.
139 .It Cm export Ar sourceBe
140 Export
141 .Ar sourceBe
142 to
143 .Dv stdout .
144 .Dv stdout
145 must be piped or redirected to a file.
146 .It Cm import Ar targetBe
147 Import
148 .Ar targetBe
149 from
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
158 Creates a jail of the given boot environment.
159 Multiple
160 .Fl o
161 and
162 .Fl u
163 arguments may be specified.
164 .Fl o
165 will set a jail parameter, and
166 .Fl u
167 will unset a jail parameter.
168 .Pp
169 By default, jails are created in interactive mode and
170 .Pa /bin/sh
171 is
172 executed within the jail.
173 If
174 .Ar utility
175 is specified, it will be executed instead of
176 .Pa /bin/sh .
177 The jail will be destroyed and the boot environment unmounted when the command
178 finishes executing, unless the
179 .Fl U
180 argument is specified.
181 .Pp
182 The
183 .Fl b
184 argument enables batch mode, thereby disabling interactive mode.
185 The
186 .Fl U
187 argument will be ignored in batch mode.
188 .Pp
189 The
190 .Va name ,
191 .Va host.hostname ,
192 and
193 .Va path
194 must be set, the default values are specified below.
195 .Pp
196 All
197 .Ar key Ns = Ns Ar value
198 pairs are interpreted as jail parameters as described in
199 .Xr jail 8 .
200 The 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
211 All default parameters may be overwritten.
212 .It Cm list Op Fl DHas
213 Displays all boot environments.
214 The Active field indicates whether the boot environment is active now (N);
215 active on reboot (R); or both (NR).
216 .Pp
217 If
218 .Fl a
219 is used, display all datasets.
220 If
221 .Fl D
222 is used, display the full space usage for each boot environment, assuming all
223 other boot environments were destroyed.
224 The
225 .Fl H
226 option is used for scripting.
227 It does not print headers and separate fields by a single tab instead of
228 arbitrary white space.
229 If
230 .Fl s
231 is used, display all snapshots as well.
232 .It Cm mount Ar beName Op Ar mountpoint
233 Temporarily mount the boot environment.
234 Mount at the specified
235 .Ar mountpoint
236 if provided.
237 .It Cm rename Ar origBeName newBeName
238 Renames the given
239 .Ar origBeName
240 to the given
241 .Ar newBeName .
242 The boot environment will not be unmounted in order for this rename to occur.
243 .It Cm unjail Brq Ar jailID | jailName | beName
244 Destroys the jail created from the given boot environment.
245 .It Xo
246 .Cm unmount
247 .Op Fl f
248 .Ar beName
249 .Xc
250 Unmount the given boot environment, if it is mounted.
251 Specifying
252 .Fl f
253 will force the unmount if busy.
254 .El
255 .Sh EXAMPLES
256 .Bl -bullet
257 .It
258 To 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
267 is based on
268 .Nm beadm
269 and was implemented as a project for the 2017 Summer of Code, along with
270 .Xr libbe 3 .
271 .Sh AUTHORS
272 .Nm
273 was written by
274 .An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in .
275 .Pp
276 .Nm beadm
277 was 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
281 wrote the original
282 .Nm beadm
283 manual page that this one is derived from.