xref: /freebsd/sbin/bectl/bectl.8 (revision db9db0e790be3439ca443caa2e4484a4339d1f8f)
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*db9db0e7SKyle Evans.Dd August 22, 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
295952343eSKyle Evansactivate
305952343eSKyle Evans.Op Fl t
315952343eSKyle Evans.Ao Ar beName Ac
325952343eSKyle Evans.Nm
335952343eSKyle Evanscreate
345952343eSKyle Evans.Op Fl r
355952343eSKyle Evans.Op Fl e Ar nonActiveBe | Fl e Ar beName@snapshot
365952343eSKyle Evans.Ao Ar beName Ac
375952343eSKyle Evans.Nm
385952343eSKyle Evanscreate
395952343eSKyle Evans.Op Fl r
405952343eSKyle Evans.Ao Ar beName@snapshot Ac
415952343eSKyle Evans.Nm
425952343eSKyle Evansdestroy
435952343eSKyle Evans.Op Fl F
445952343eSKyle Evans.Ao Ar beName | beName@snapshot Ac
455952343eSKyle Evans.Nm
4634761e84SKyle Evansexport
4734761e84SKyle Evans.Ao Ar sourceBe Ac
4834761e84SKyle Evans.Nm
4934761e84SKyle Evansimport
5034761e84SKyle Evans.Ao Ar targetBe Ac
5134761e84SKyle Evans.Nm
525952343eSKyle Evansjail
53*db9db0e7SKyle Evans.Op Fl b | Fl U
542a0b8dc2SKyle Evans.Oo Fl o Ar key Ns = Ns Ar value | Fl u Ar key Oc Ns ...
555952343eSKyle Evans.Ao Ar jailID | jailName Ac
565952343eSKyle Evans.Ao Ar bootenv Ac
57cd816834SKyle Evans.Op Ar utility Op Ar argument ...
585952343eSKyle Evans.Nm
595952343eSKyle Evanslist
605952343eSKyle Evans.Op Fl a
615952343eSKyle Evans.Op Fl D
625952343eSKyle Evans.Op Fl H
635952343eSKyle Evans.Op Fl s
645952343eSKyle Evans.Nm
655952343eSKyle Evansmount
665952343eSKyle Evans.Ao Ar beName Ac
675952343eSKyle Evans.Op mountpoint
685952343eSKyle Evans.Nm
695952343eSKyle Evansrename
705952343eSKyle Evans.Ao Ar origBeName Ac
715952343eSKyle Evans.Ao Ar newBeName Ac
725952343eSKyle Evans.Nm
735952343eSKyle Evans{ ujail | unjail }
745952343eSKyle Evans.Ao Ar jailID | jailName Ac
755952343eSKyle Evans.Ao Ar bootenv Ac
765952343eSKyle Evans.Nm
775952343eSKyle Evans{ umount | unmount }
785952343eSKyle Evans.Op Fl f
795952343eSKyle Evans.Ao Ar beName Ac
805952343eSKyle Evans.Sh DESCRIPTION
815952343eSKyle EvansThe
825952343eSKyle Evans.Nm
835952343eSKyle Evanscommand is used to setup and interact with ZFS boot environments, which are bootable clones of datasets.
845952343eSKyle Evans.Pp
855952343eSKyle Evans.Em Boot Environments
865952343eSKyle Evansallows the system to be upgraded, while preserving the old system environment in a separate ZFS dataset.
875952343eSKyle Evans.Sh COMMANDS
885952343eSKyle EvansThe following commands are supported by
895952343eSKyle Evans.Nm :
905952343eSKyle Evans.Bl -tag -width activate
915952343eSKyle Evans.It Ic activate
925952343eSKyle Evans.Op Fl t
935952343eSKyle Evans.Ar <beName>
945952343eSKyle Evans.Pp
955952343eSKyle EvansActivate the given
965952343eSKyle Evans.Ar beName
9784e61219SKyle Evansas the default boot filesystem.
9884e61219SKyle EvansIf the
995952343eSKyle Evans.Op Fl t
1005952343eSKyle Evansflag is given, this takes effect only for the next boot.
1015952343eSKyle Evans.It Ic create
1025952343eSKyle Evans.Op Fl r
1035952343eSKyle Evans.Op Fl e Ar nonActiveBe | Fl e Ar beName@snapshot
1045952343eSKyle Evans.Ao Ar beName Ac
1055952343eSKyle Evans.Pp
1065952343eSKyle EvansCreates a new boot environment named
1075952343eSKyle Evans.Ar beName .
1085952343eSKyle EvansIf the -e param is specified, the new environment will be cloned from the given
1095952343eSKyle Evans.Ar nonActiveBe | Ar beName@snapshot .
1105952343eSKyle EvansIf the
1115952343eSKyle Evans.Op Fl r
1125952343eSKyle Evansflag is given, a recursive boot environment will be made.
1135952343eSKyle Evans.It Ic create
1145952343eSKyle Evans.Op Fl r
1155952343eSKyle Evans.Ao Ar beName@snapshot Ac
1165952343eSKyle Evans.Pp
1175952343eSKyle EvansCreates a snapshot of the existing boot environment named
1185952343eSKyle Evans.Ar beName .
1195952343eSKyle EvansIf the
1205952343eSKyle Evans.Op Fl r
1215952343eSKyle Evansflag is given, a recursive boot environment will be made.
1225952343eSKyle Evans.It Ic destroy
1235952343eSKyle Evans.Op Fl F
1245952343eSKyle Evans.Ao Ar beName | beName@snapshot Ac
1255952343eSKyle Evans.Pp
1265952343eSKyle EvansDestroys the given
1275952343eSKyle Evans.Ar beName
1285952343eSKyle Evansboot environment or
1295952343eSKyle Evans.Ar beName@snapshot
1305952343eSKyle Evanssnapshot.
1315952343eSKyle EvansSpecifying
1325952343eSKyle Evans.Fl F
1335952343eSKyle Evanswill automatically unmount without confirmation.
13434761e84SKyle Evans.It Ic export
13534761e84SKyle Evans.Ao Ar sourceBe Ac
13634761e84SKyle Evans.Pp
13734761e84SKyle EvansExport
13834761e84SKyle Evans.Ar sourceBe
13934761e84SKyle Evansto
14034761e84SKyle Evans.Dv stdout .
14134761e84SKyle Evans.Dv stdout
14234761e84SKyle Evansmust be piped or redirected to a file.
14334761e84SKyle Evans.It Ic import
14434761e84SKyle Evans.Ao Ar targetBe Ac
14534761e84SKyle Evans.Pp
14634761e84SKyle EvansImport
14734761e84SKyle Evans.Ar targetBe
14834761e84SKyle Evansfrom
14934761e84SKyle Evans.Dv stdin .
1505952343eSKyle Evans.It Ic jail
151*db9db0e7SKyle Evans.Op Fl b | Fl U
1522a0b8dc2SKyle Evans.Oo Fl o Ar key Ns = Ns Ar value | Fl u Ar key Oc Ns ...
1535952343eSKyle Evans.Ao Ar jailID | jailName Ac
1545952343eSKyle Evans.Ao Ar bootenv Ac
155cd816834SKyle Evans.Op Ar utility Op Ar argument ...
1565952343eSKyle Evans.Pp
1575952343eSKyle EvansCreates a jail of the given boot environment.
158d694059fSKyle EvansMultiple
159d694059fSKyle Evans.Fl o
1602a0b8dc2SKyle Evansand
1612a0b8dc2SKyle Evans.Fl u
162d694059fSKyle Evansarguments may be specified.
1632a0b8dc2SKyle Evans.Fl o
1642a0b8dc2SKyle Evanswill set a jail parameter, and
1652a0b8dc2SKyle Evans.Fl u
1662a0b8dc2SKyle Evanswill unset a jail parameter.
167cd816834SKyle Evans.Pp
168cd816834SKyle EvansBy default, jails are created in interactive mode and
169cd816834SKyle Evans.Pa /bin/sh
170cd816834SKyle Evansis
171b509cad4SKyle Evansexecuted within the jail.
172cd816834SKyle EvansIf
173cd816834SKyle Evans.Ar utility
174cd816834SKyle Evansis specified, it will be executed instead of
175cd816834SKyle Evans.Pa /bin/sh .
176*db9db0e7SKyle EvansThe jail will be destroyed and the boot environment unmounted when the command
177*db9db0e7SKyle Evansfinishes executing, unless the
178*db9db0e7SKyle Evans.Fl U
179*db9db0e7SKyle Evansargument is specified.
180cd816834SKyle Evans.Pp
181b509cad4SKyle EvansThe
182b509cad4SKyle Evans.Fl b
183b509cad4SKyle Evansargument enables batch mode, thereby disabling interactive mode.
184*db9db0e7SKyle EvansThe
185*db9db0e7SKyle Evans.Fl U
186*db9db0e7SKyle Evansargument will be ignored in batch mode.
1872a0b8dc2SKyle Evans.Pp
1882a0b8dc2SKyle EvansThe
1892a0b8dc2SKyle Evans.Va name ,
1902a0b8dc2SKyle Evans.Va host.hostname ,
1912a0b8dc2SKyle Evansand
1922a0b8dc2SKyle Evans.Va path
1932a0b8dc2SKyle Evansmay not actually be unset.
1942a0b8dc2SKyle EvansAttempts to unset any of these will revert them to the default values specified
1952a0b8dc2SKyle Evansbelow, if they have been overwritten by
1962a0b8dc2SKyle Evans.Fl o .
1972a0b8dc2SKyle Evans.Pp
1982a0b8dc2SKyle EvansAll
199d694059fSKyle Evans.Ar key ,
200d694059fSKyle Evans.Ar value
201d694059fSKyle Evanspairs are interpreted as jail parameters as described in
202d694059fSKyle Evans.Xr jail 8 .
203d694059fSKyle EvansThe following default parameters are provided:
204d694059fSKyle Evans.Bl -tag -width -indent
205d694059fSKyle Evans.It Va allow.mount Ns = Ns Ar true
206d694059fSKyle Evans.It Va allow.mount.devfs Ns = Ns Ar true
207d694059fSKyle Evans.It Va enforce_statfs Ns = Ns Ar 1
208d694059fSKyle Evans.It Va name Ns = Ns Ar bootenv
209d694059fSKyle Evans.It Va host.hostname Ns = Ns Ar bootenv
210d694059fSKyle Evans.It Va path
211d694059fSKyle EvansSet to a path in /tmp generated by
21284e61219SKyle Evans.Xr libbe 3 .
213d694059fSKyle Evans.El
2145952343eSKyle Evans.Pp
2152a0b8dc2SKyle EvansAll default parameters may be overwritten.
2165952343eSKyle Evans.It Ic list
2175952343eSKyle Evans.Op Fl a
2185952343eSKyle Evans.Op Fl D
2195952343eSKyle Evans.Op Fl H
2205952343eSKyle Evans.Op Fl s
2215952343eSKyle Evans.Pp
2225952343eSKyle EvansDisplays all boot environments.
2235952343eSKyle EvansThe Active field indicates whether the boot environment is active now (N); active on reboot (R); or both (NR).
2245952343eSKyle Evans.Pp
2255952343eSKyle EvansIf
2265952343eSKyle Evans.Fl a
2275952343eSKyle Evansis used, display all datasets.
2285952343eSKyle EvansIf
2295952343eSKyle Evans.Fl D
2305952343eSKyle Evansis used, display the full space usage for each boot environment, assuming all other boot environments were destroyed.
2315952343eSKyle EvansThe
2325952343eSKyle Evans.Fl H
23384e61219SKyle Evansoption is used for scripting.
23484e61219SKyle EvansIt does not print headers and separate fields by a single tab instead of arbitrary white space.
2355952343eSKyle EvansIf
2365952343eSKyle Evans.Fl s
2375952343eSKyle Evansis used, display all snapshots as well.
2385952343eSKyle Evans.It Ic mount
2395952343eSKyle Evans.Ao Ar beName Ac
2405952343eSKyle Evans.Op mountpoint
2415952343eSKyle Evans.Pp
2425952343eSKyle EvansTemporarily mount the boot environment.
2435952343eSKyle EvansMount at the specified
2445952343eSKyle Evans.Ar mountpoint
2455952343eSKyle Evansif provided.
2465952343eSKyle Evans.It Ic rename Ao Ar origBeName Ac Ao Ar newBeName Ac
2475952343eSKyle Evans.Pp
2485952343eSKyle EvansRenames the given nonactive
2495952343eSKyle Evans.Ar origBeName
2505952343eSKyle Evansto the given
2515952343eSKyle Evans.Ar newBeName
252216d4359SKyle Evans.It Ic unjail Ao Ar jailID | jailName | beName Ac
253216d4359SKyle Evans.Pp
254216d4359SKyle EvansDestroys the jail created from the given boot environment.
2555952343eSKyle Evans.It Ic unmount
2565952343eSKyle Evans.Op Fl f
2575952343eSKyle Evans.Ao Ar beName Ac
2585952343eSKyle Evans.Pp
2595952343eSKyle EvansUnmount the given boot environment, if it is mounted.
2605952343eSKyle EvansSpecifying
2615952343eSKyle Evans.Fl f
2625952343eSKyle Evanswill force the unmount if busy.
2635952343eSKyle Evans.El
2645952343eSKyle Evans.Sh EXAMPLES
2655952343eSKyle Evans.Bl -bullet
2665952343eSKyle Evans.It
2675952343eSKyle EvansTo fill in with jail upgrade example when behavior is firm.
26884e61219SKyle Evans.El
2695952343eSKyle Evans.Sh SEE ALSO
2705952343eSKyle Evans.Xr jail 8 ,
2715952343eSKyle Evans.Xr zfs 8 ,
2725952343eSKyle Evans.Xr zpool 8
2735952343eSKyle Evans.Sh HISTORY
2745952343eSKyle Evans.Nm
2755952343eSKyle Evansis based on
2765952343eSKyle Evans.Xr beadm 1
2775952343eSKyle Evansand was implemented as a project for the 2017 Summer of Code, along with
2785952343eSKyle Evans.Xr libbe 3 .
2795952343eSKyle Evans.Sh AUTHORS
2805952343eSKyle Evans.Bl -bullet
2815952343eSKyle Evans.It
28234761e84SKyle Evans.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in
2835952343eSKyle Evans.Pp
2845952343eSKyle EvansCreator of
2855952343eSKyle Evans.Nm .
2865952343eSKyle Evans.It
28734761e84SKyle Evans.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl
2885952343eSKyle Evans.Pp
2895952343eSKyle EvansCreator and maintainer of
2905952343eSKyle Evans.Xr beadm 1 .
2915952343eSKyle Evans.It
29234761e84SKyle Evans.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net
2935952343eSKyle Evans.Pp
2945952343eSKyle EvansWrote the original
2955952343eSKyle Evans.Xr beadm 1
2965952343eSKyle Evansmanual page that this one is derived from.
2975952343eSKyle Evans.El
298