-
Notifications
You must be signed in to change notification settings - Fork 43
/
beadm.8
251 lines (251 loc) · 5.26 KB
/
beadm.8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
.\"
.\" beadm - Illumos/Solaris-like utility for FreeBSD to manage
.\" Boot Environments on ZFS filesystems
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\"
.\" @(#)beadm.8
.\" $FreeBSD$
.\"
.Dd May 6, 2022
.Dt BEADM 8
.Os
.Sh NAME
.Nm beadm
.Nd manage boot environments with ZFS
.Sh SYNOPSIS
.Nm
.Cm activate Ar beName
.Nm
.Cm create Op Fl e Ar nonActiveBe Ns | Ns Ar beName Ns Cm @ Ns Ar snapshot
.Ar beName
.Nm
.Cm create
.Ar beName Ns Cm @ Ns Ar snapshot
.Nm
.Cm destroy Op Fl F
.Ar beName Ns | Ns Ar beName Ns Cm @ Ns Ar snapshot
.Nm
.Cm export
.Op Fl v
.Ar beName
.Nm
.Cm import
.Op Fl v
.Ar beName
.Nm Cm list
.Op Fl aDHs
.Nm
.Cm mount
.Ar beName
.Op Ar mountpoint
.Nm
.Cm rename Ar origBeName Ar newBeName
.Nm
.Cm umount Op Fl f Ar beName
.Nm
.Cm chroot Ar beName
.Nm
.Cm reroot Ar beName
.Nm
.Cm version
.Sh DESCRIPTION
The
.Nm
command is used to setup and interact with boot environments with ZFS.
.Pp
Boot environments allow the system to be upgraded, while preserving the old
system environment in a separate ZFS dataset.
.Sh COMMANDS
The following commands are supported by
.Nm :
.Bl -tag -width indent
.It Cm activate Ar beName
Activate the given
.Ar beName
for the next boot.
.It Cm create Xo
.Op Fl e Ar nonActiveBe Ns | Ns Ar beName Ns Cm @ Ns Ar snapshot
.Ar beName
.Xc
Create a new boot environment named
.Ar beName .
If the
.Fl e
option is specified, the new environment will be cloned from the given
.Ar nonActiveBe
boot environment
or
.Ar beName Ns Cm @ Ns Ar snapshot
snapshot.
.It Cm create Ar beName Ns Cm @ Ns Ar snapshot
Create a snapshot of the existing boot environment named
.Ar beName .
.It Xo
.Cm destroy Op Fl F
.Ar beName Ns | Ns Ar beName Ns Cm @ Ns Ar snapshot
.Xc
Destroy the given
.Ar beName
boot environment
or
.Ar beName Ns Cm @ Ns Ar snapshot
snapshot.
Specifying
.Fl F
will automatically unmount the target without confirmation.
.It Cm export Ar beName
Export
.Ar beName
to the
.Xr stdout 4 .
Use pipe or redirect the output to a file.
.Bl -tag -width "-v"
.It Fl v
Display verbose output on the export operation.
.El
.It Cm import Ar beName
Import
.Ar beName
from
.Xr stdin 4
input.
.Bl -tag -width "-v"
.It Fl v
Display verbose output on the export operation.
.El
.It Cm list Op Fl aDHs
Display all boot environments.
The
.Qq Active
field indicates whether the boot environment is active now
.Pq Qq N ;
active on reboot
.Pq Qq R ;
or both
.Pq Qq NR .
.Pp
The following options are available:
.Bl -tag -width "-a"
.It Fl a
Display all datasets.
.It Fl D
Display the full space usage for each boot environment, assuming all other boot
environments were destroyed.
.It Fl H
Does not print headers and separate fields by a single tab instead of arbitrary
white space.
Use for scripting.
.It Fl s
Display all snapshots.
.El
.It Cm mount Ar beName Op Ar mountpoint
Temporarily mount the
.Ar beName
boot environment.
Mount at the specified
.Ar mountpoint
if provided.
.It Cm rename Ar origBeName Ar newBeName
Rename the given nonactive
.Ar origBeName
boot environment
to
.Ar newBeName .
.It Cm umount Op Fl f Ar beName
Unmount the given boot environment, if it is mounted.
Specifying
.Fl f
will force the unmount if busy.
This command can be called with either
.Cm umount
or
.Cm unmount .
.It Cm chroot
Enter to selected boot environment with the
.Xr chroot 8
command.
.It Cm reroot
Use 'reroot' feature from the
.Xr reboot 8 -r
command.
.It Cm version
Print the
.Nm
version and exit.
.El
.Sh EXAMPLES
.Bl -tag -width indent
.It Perform a system upgrade in a Xr jail 8 :
.Pp
Create a new boot environment called
.Em jailed :
.Bd -literal -offset indent
beadm create -e default jailed
.Ed
.Pp
Set a mountpoint for the new jail to
.Pa /usr/jails/jailed :
.Bd -literal -offset indent
beadm mount jailed /usr/jails/jailed
.Ed
.Pp
The currently active boot environment is now replicated into the jailed system
and ready for an upgrade.
Start up the jail, log in and perform the normal upgrade process.
Once this is done, stop the jail and disable it in
.Pa /etc/rc.conf .
Now activate the boot environment for the next boot:
.Bd -literal -offset indent
beadm activate jailed
.Ed
.Pp
Reboot into the new environment:
.Bd -literal -offset indent
reboot
.Ed
.El
.Sh SEE ALSO
.Xr jail 8 ,
.Xr zfs 8 ,
.Xr zpool 8
.Pp
The original
.Dq Fx ZFS Madness
how-to guide is available at the
.Fx
Forums:
.Lk https://forums.freebsd.org/showthread.php?t=31662
.Sh HISTORY
.Xr beadm 1M
originally appeared in Solaris.
.Sh AUTHORS
.Bl -tag -width indent
.It An Slawomir Wojciech Wojtczak (vermaden) Aq Mt [email protected] :
.Bl -dash
.It
Creator and maintainer of
.Nm .
.El
.It An Bryan Drewery (bdrewery) Aq Mt [email protected] :
.Bl -dash
.It
Wrote this manual page and contributed child dataset fixes.
.El
.It An Mike Clarke (rawthey) Aq Mt [email protected] :
.Bl -dash
.It
Wrote fast implementation of
.Nm Ar list .
.It
Contributed a lot of fixes and usability changes.
.El
.El