2018-07-24 13:17:40 +00:00
|
|
|
.\"
|
2018-08-07 13:46:06 +00:00
|
|
|
.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2017 Kyle J. Kneitinger <kyle@kneit.in>
|
2018-07-24 13:17:40 +00:00
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
|
|
|
.\"
|
|
|
|
.\" @(#)be.1
|
2018-08-07 14:02:41 +00:00
|
|
|
.\"
|
2018-07-24 13:17:40 +00:00
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2020-08-17 08:24:50 +00:00
|
|
|
.Dd August 17, 2020
|
2018-07-24 13:24:30 +00:00
|
|
|
.Dt BECTL 8
|
2018-08-11 01:40:24 +00:00
|
|
|
.Os
|
2018-07-24 13:17:40 +00:00
|
|
|
.Sh NAME
|
2018-07-24 13:24:30 +00:00
|
|
|
.Nm bectl
|
2019-04-03 13:46:43 +00:00
|
|
|
.Nd Utility to manage boot environments on ZFS
|
2018-07-24 13:17:40 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm activate
|
2018-07-24 13:17:40 +00:00
|
|
|
.Op Fl t
|
2018-08-23 02:09:52 +00:00
|
|
|
.Ar beName
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2019-09-11 13:27:10 +00:00
|
|
|
.Cm check
|
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm create
|
2018-07-24 13:17:40 +00:00
|
|
|
.Op Fl r
|
2019-04-03 13:46:43 +00:00
|
|
|
.Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot
|
|
|
|
.Ar newBeName
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2019-05-22 23:07:40 +00:00
|
|
|
.Cm create
|
|
|
|
.Op Fl r
|
|
|
|
.Ar beName@snapshot
|
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm destroy
|
2019-02-11 04:00:01 +00:00
|
|
|
.Op Fl \&Fo
|
2019-04-03 13:46:43 +00:00
|
|
|
.Ar beName Ns Op Cm @ Ns Ar snapshot
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm export
|
|
|
|
.Ar sourceBe
|
2018-08-11 04:01:24 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm import
|
|
|
|
.Ar targetBe
|
2018-08-11 04:01:24 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm jail
|
2019-04-03 13:46:43 +00:00
|
|
|
.Op Fl bU
|
|
|
|
.Oo Bro Fl o Ar key Ns Cm = Ns Ar value | Fl u Ar key Brc Oc Ns ...
|
|
|
|
.Ar beName
|
2018-08-18 01:12:44 +00:00
|
|
|
.Op Ar utility Op Ar argument ...
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm list
|
2019-04-03 13:46:43 +00:00
|
|
|
.Op Fl aDHs
|
2019-09-04 13:59:06 +00:00
|
|
|
.Op Fl c Ar property
|
|
|
|
.Op Fl C Ar property
|
|
|
|
.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm mount
|
|
|
|
.Ar beName
|
2019-04-03 13:46:43 +00:00
|
|
|
.Op Ar mountpoint
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm rename
|
|
|
|
.Ar origBeName
|
|
|
|
.Ar newBeName
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Brq Cm ujail | unjail
|
2019-04-03 13:46:43 +00:00
|
|
|
.Brq Ar jailId | jailName
|
|
|
|
.Ar beName
|
2018-07-24 13:17:40 +00:00
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
.Brq Cm umount | unmount
|
2018-07-24 13:17:40 +00:00
|
|
|
.Op Fl f
|
2018-08-23 02:09:52 +00:00
|
|
|
.Ar beName
|
2019-04-03 13:46:43 +00:00
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
.Op Fl h\&?
|
2018-07-24 13:17:40 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
2018-08-23 02:09:52 +00:00
|
|
|
command is used to setup and interact with ZFS boot environments, which are
|
|
|
|
bootable clones of datasets.
|
2018-07-24 13:17:40 +00:00
|
|
|
.Pp
|
2019-04-03 13:46:43 +00:00
|
|
|
Boot environments
|
|
|
|
allow the system to be upgraded, while preserving the old system environment in
|
2018-08-23 02:09:52 +00:00
|
|
|
a separate ZFS dataset.
|
2019-04-03 13:46:43 +00:00
|
|
|
.Pp
|
2018-07-24 13:17:40 +00:00
|
|
|
The following commands are supported by
|
|
|
|
.Nm :
|
|
|
|
.Bl -tag -width activate
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Xo
|
|
|
|
.Cm activate
|
2018-07-24 13:17:40 +00:00
|
|
|
.Op Fl t
|
2018-08-23 02:09:52 +00:00
|
|
|
.Ar beName
|
|
|
|
.Xc
|
2018-07-24 13:17:40 +00:00
|
|
|
Activate the given
|
|
|
|
.Ar beName
|
2018-08-11 01:40:24 +00:00
|
|
|
as the default boot filesystem.
|
|
|
|
If the
|
2020-08-17 08:24:50 +00:00
|
|
|
.Fl t
|
2018-07-24 13:17:40 +00:00
|
|
|
flag is given, this takes effect only for the next boot.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Xo
|
2019-09-11 13:27:10 +00:00
|
|
|
.Cm check
|
|
|
|
.Xc
|
|
|
|
Performs a silent sanity check on the current system.
|
|
|
|
If boot environments are supported and used,
|
|
|
|
.Nm
|
|
|
|
will exit with a status code of 0.
|
|
|
|
Any other status code is not currently defined and may, in the future, grow
|
|
|
|
special meaning for different degrees of sanity check failures.
|
|
|
|
.It Xo
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm create
|
2018-07-24 13:17:40 +00:00
|
|
|
.Op Fl r
|
2019-04-03 13:46:43 +00:00
|
|
|
.Op Fl e Brq Ar nonActiveBe | Ar beName Ns Cm @ Ns Ar snapshot
|
|
|
|
.Ar newBeName
|
2018-08-23 02:09:52 +00:00
|
|
|
.Xc
|
2019-04-03 13:46:43 +00:00
|
|
|
Create a new boot environment named
|
|
|
|
.Ar newBeName .
|
|
|
|
.Pp
|
2018-08-23 02:09:52 +00:00
|
|
|
If the
|
|
|
|
.Fl r
|
2018-07-24 13:17:40 +00:00
|
|
|
flag is given, a recursive boot environment will be made.
|
2019-04-03 13:46:43 +00:00
|
|
|
.Pp
|
2018-07-24 13:17:40 +00:00
|
|
|
If the
|
2019-04-03 13:46:43 +00:00
|
|
|
.Fl e
|
|
|
|
flag is specified, the new environment will be cloned from the given
|
|
|
|
.Ar nonActiveBe
|
|
|
|
or
|
|
|
|
.Ar beName Ns Cm @ Ns Ar snapshot .
|
|
|
|
Otherwise, the new environment will be created from the currently booted environment.
|
|
|
|
.Pp
|
|
|
|
If
|
|
|
|
.Nm
|
|
|
|
is creating from another boot environment, a snapshot of that boot environment will be created to clone from.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Xo
|
2019-05-22 23:07:40 +00:00
|
|
|
.Cm create
|
|
|
|
.Op Fl r
|
|
|
|
.Ar beName@snapshot
|
|
|
|
.Xc
|
|
|
|
Create a snapshot of the boot environment named
|
|
|
|
.Ar beName .
|
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl r
|
|
|
|
flag is given, a recursive snapshot of the boot environment will be created.
|
|
|
|
A snapshot is created for each descendant dataset of the boot environment.
|
|
|
|
.Pp
|
|
|
|
No new boot environment is created with this command.
|
|
|
|
.It Xo
|
2018-08-23 02:09:52 +00:00
|
|
|
.Cm destroy
|
2019-02-11 04:00:01 +00:00
|
|
|
.Op Fl \&Fo
|
2019-04-03 13:46:43 +00:00
|
|
|
.Ar beName Ns Op Cm @ Ns Ar snapshot
|
2018-08-23 02:09:52 +00:00
|
|
|
.Xc
|
2019-04-03 13:46:43 +00:00
|
|
|
Destroy the given
|
2018-07-24 13:17:40 +00:00
|
|
|
.Ar beName
|
|
|
|
boot environment or
|
2019-04-03 13:46:43 +00:00
|
|
|
.Ar beName Ns Cm @ Ns Ar snapshot
|
2018-08-24 20:44:58 +00:00
|
|
|
snapshot without confirmation, unlike in
|
2019-04-03 13:46:43 +00:00
|
|
|
.Xr beadm 1 .
|
2018-07-24 13:17:40 +00:00
|
|
|
Specifying
|
|
|
|
.Fl F
|
|
|
|
will automatically unmount without confirmation.
|
2019-02-11 04:00:01 +00:00
|
|
|
.Pp
|
|
|
|
By default,
|
|
|
|
.Nm
|
|
|
|
will warn that it is not destroying the origin of
|
|
|
|
.Ar beName .
|
|
|
|
The
|
|
|
|
.Fl o
|
|
|
|
flag may be specified to destroy the origin as well.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Cm export Ar sourceBe
|
2018-08-11 04:01:24 +00:00
|
|
|
Export
|
|
|
|
.Ar sourceBe
|
|
|
|
to
|
2019-04-03 13:46:43 +00:00
|
|
|
.Xr stdout 4 .
|
|
|
|
.Xr stdout 4
|
2018-08-11 04:01:24 +00:00
|
|
|
must be piped or redirected to a file.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Cm import Ar targetBe
|
2018-08-11 04:01:24 +00:00
|
|
|
Import
|
|
|
|
.Ar targetBe
|
|
|
|
from
|
2019-04-03 13:46:43 +00:00
|
|
|
.Xr stdin 4 .
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Xo
|
|
|
|
.Cm jail
|
2019-04-03 13:46:43 +00:00
|
|
|
.Op Fl bU
|
|
|
|
.Oo Bro Fl o Ar key Ns Cm = Ns Ar value | Fl u Ar key Brc Oc Ns ...
|
|
|
|
.Ar beName
|
2018-08-18 01:12:44 +00:00
|
|
|
.Op Ar utility Op Ar argument ...
|
2018-08-23 02:09:52 +00:00
|
|
|
.Xc
|
2019-04-03 13:46:43 +00:00
|
|
|
Create a jail of the given boot environment.
|
2018-08-06 03:32:25 +00:00
|
|
|
Multiple
|
|
|
|
.Fl o
|
2018-08-06 15:21:46 +00:00
|
|
|
and
|
|
|
|
.Fl u
|
2018-08-06 03:32:25 +00:00
|
|
|
arguments may be specified.
|
2018-08-06 15:21:46 +00:00
|
|
|
.Fl o
|
|
|
|
will set a jail parameter, and
|
|
|
|
.Fl u
|
|
|
|
will unset a jail parameter.
|
2018-08-18 01:12:44 +00:00
|
|
|
.Pp
|
|
|
|
By default, jails are created in interactive mode and
|
|
|
|
.Pa /bin/sh
|
|
|
|
is
|
2018-08-17 01:59:19 +00:00
|
|
|
executed within the jail.
|
2018-08-18 01:12:44 +00:00
|
|
|
If
|
|
|
|
.Ar utility
|
|
|
|
is specified, it will be executed instead of
|
|
|
|
.Pa /bin/sh .
|
2018-08-23 01:45:18 +00:00
|
|
|
The jail will be destroyed and the boot environment unmounted when the command
|
|
|
|
finishes executing, unless the
|
|
|
|
.Fl U
|
|
|
|
argument is specified.
|
2018-08-18 01:12:44 +00:00
|
|
|
.Pp
|
2018-08-17 01:59:19 +00:00
|
|
|
The
|
|
|
|
.Fl b
|
|
|
|
argument enables batch mode, thereby disabling interactive mode.
|
2018-08-23 01:45:18 +00:00
|
|
|
The
|
|
|
|
.Fl U
|
|
|
|
argument will be ignored in batch mode.
|
2018-08-06 15:21:46 +00:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Va name ,
|
|
|
|
.Va host.hostname ,
|
|
|
|
and
|
|
|
|
.Va path
|
bectl: use jail id as the default jail name for a boot environment
By default, bectl is setting the jail 'name' parameter to the boot
environment name, which causes an error when the boot environment name is
not a valid jail name. With the attached fix, when no name is supplied, the
default jail name will be the jail id - this is is the same behavior as the
jail command.
Additionally, this commit addresses two other bugs that prevented unjailing
in scenarios where the jail name does not match the boot environment name:
1. In 'bectl_locate_jail', 'mountpoint' is used to resolve the boot
environment path, but really 'mounted' should be used. 'mountpoint' is the
path where the zfs dataset will be mounted. 'mounted' is the path where
the dataset is actually mounted.
2. in 'bectl_search_jail_paths', 'jail_getv' would fail after the first
call. Which is fine, if the boot environment you're unjailing is the next
one up. According to 'man jail_getv', it's expecting name and value
strings. 'jail_getv' is being passed an integer for the lastjid, so amend
that to use a string instead.
Test cases have been amended to reflect the bugs found.
PR: 233637
Submitted by: Rob <rob.fx907_gmail.com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18607
2018-12-25 15:18:41 +00:00
|
|
|
must be set, the default values are specified below.
|
2018-08-06 15:21:46 +00:00
|
|
|
.Pp
|
|
|
|
All
|
2019-04-03 13:46:43 +00:00
|
|
|
.Ar key Ns Cm = Ns Ar value
|
2018-08-06 03:32:25 +00:00
|
|
|
pairs are interpreted as jail parameters as described in
|
|
|
|
.Xr jail 8 .
|
|
|
|
The following default parameters are provided:
|
2018-08-23 02:09:52 +00:00
|
|
|
.Bl -column "allow.mount.devfs" ""
|
|
|
|
.It Va allow.mount Ta Cm true
|
|
|
|
.It Va allow.mount.devfs Ta Cm true
|
|
|
|
.It Va enforce_statfs Ta Cm 1
|
2019-04-03 13:46:43 +00:00
|
|
|
.It Va name Ta Set to jail ID.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Va host.hostname Ta Va bootenv
|
2019-04-03 13:46:43 +00:00
|
|
|
.It Va path Ta Set to a path in Pa /tmp
|
|
|
|
generated by
|
2018-08-11 01:40:24 +00:00
|
|
|
.Xr libbe 3 .
|
2018-08-06 03:32:25 +00:00
|
|
|
.El
|
2018-07-24 13:17:40 +00:00
|
|
|
.Pp
|
2018-08-06 15:21:46 +00:00
|
|
|
All default parameters may be overwritten.
|
2019-09-04 13:59:06 +00:00
|
|
|
.It Xo
|
|
|
|
.Cm list
|
|
|
|
.Op Fl DHas
|
|
|
|
.Oo Bro Fl c Ar property | Fl C Ar property Brc Oc
|
|
|
|
.Xc
|
|
|
|
.Pp
|
2019-04-03 13:46:43 +00:00
|
|
|
Display all boot environments.
|
|
|
|
The
|
|
|
|
.Em Active
|
|
|
|
field indicates whether the boot environment is active now
|
|
|
|
.Pq Em \&N ;
|
|
|
|
active on reboot
|
|
|
|
.Pq Em \&R ;
|
|
|
|
or both
|
|
|
|
.Pq Em \&NR .
|
2018-07-24 13:17:40 +00:00
|
|
|
.Pp
|
2019-09-04 13:59:06 +00:00
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Fl a
|
|
|
|
Display all datasets.
|
|
|
|
.It Fl D
|
|
|
|
Display the full space usage for each boot environment, assuming all
|
2018-08-23 02:09:52 +00:00
|
|
|
other boot environments were destroyed.
|
2019-09-04 13:59:06 +00:00
|
|
|
.It Fl H
|
|
|
|
Used for scripting.
|
|
|
|
Do not print headers and separate fields by a single tab instead of
|
2018-08-23 02:09:52 +00:00
|
|
|
arbitrary white space.
|
2019-09-04 13:59:06 +00:00
|
|
|
.It Fl s
|
|
|
|
Display all snapshots as well.
|
|
|
|
.It Fl c Ar property
|
|
|
|
Sort boot environments by given property name.
|
|
|
|
The following properties are supported:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width 4n -offset indent -compact
|
|
|
|
.It name (default output)
|
|
|
|
.It creation
|
|
|
|
.It origin
|
|
|
|
.It used
|
|
|
|
.It usedds
|
|
|
|
.It usedsnap
|
|
|
|
.It usedrefreserv
|
|
|
|
.El
|
|
|
|
.It Fl C Ar property
|
|
|
|
Same as the
|
|
|
|
.Fl c
|
|
|
|
option, but displays in descending order.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fl D
|
|
|
|
option is ignored when either the
|
2018-07-24 13:17:40 +00:00
|
|
|
.Fl s
|
2019-09-04 13:59:06 +00:00
|
|
|
or
|
|
|
|
.Fl a
|
|
|
|
option is used.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Cm mount Ar beName Op Ar mountpoint
|
2018-07-24 13:17:40 +00:00
|
|
|
Temporarily mount the boot environment.
|
|
|
|
Mount at the specified
|
|
|
|
.Ar mountpoint
|
|
|
|
if provided.
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Cm rename Ar origBeName newBeName
|
2019-04-03 13:46:43 +00:00
|
|
|
Rename the given
|
2018-07-24 13:17:40 +00:00
|
|
|
.Ar origBeName
|
|
|
|
to the given
|
2018-08-23 02:09:52 +00:00
|
|
|
.Ar newBeName .
|
2018-08-24 20:44:58 +00:00
|
|
|
The boot environment will not be unmounted in order for this rename to occur.
|
2019-04-03 13:46:43 +00:00
|
|
|
.It Cm ujail Bro Ar jailId | jailName Brc Ar beName
|
|
|
|
.It Cm unjail Bro Ar jailId | jailName Brc Ar beName
|
|
|
|
Destroy the jail created from the given boot environment.
|
|
|
|
.It Xo
|
|
|
|
.Cm umount
|
|
|
|
.Op Fl f
|
|
|
|
.Ar beName
|
|
|
|
.Xc
|
2018-08-23 02:09:52 +00:00
|
|
|
.It Xo
|
|
|
|
.Cm unmount
|
2018-07-24 13:17:40 +00:00
|
|
|
.Op Fl f
|
2018-08-23 02:09:52 +00:00
|
|
|
.Ar beName
|
|
|
|
.Xc
|
2018-07-24 13:17:40 +00:00
|
|
|
Unmount the given boot environment, if it is mounted.
|
|
|
|
Specifying
|
|
|
|
.Fl f
|
|
|
|
will force the unmount if busy.
|
|
|
|
.El
|
2019-04-03 13:46:43 +00:00
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
prints usage information if
|
|
|
|
.Fl h
|
|
|
|
or
|
|
|
|
.Fl \&?
|
|
|
|
is specified.
|
2020-08-17 08:43:36 +00:00
|
|
|
\" .Sh EXAMPLES
|
|
|
|
\" .Bl -bullet
|
|
|
|
\" .It
|
|
|
|
\" To fill in with jail upgrade example when behavior is firm.
|
|
|
|
\" .El
|
2018-07-24 13:17:40 +00:00
|
|
|
.Sh SEE ALSO
|
2018-11-21 12:46:28 +00:00
|
|
|
.Xr libbe 3 ,
|
2020-04-19 01:43:59 +00:00
|
|
|
.Xr beinstall.sh 8 ,
|
2018-07-24 13:17:40 +00:00
|
|
|
.Xr jail 8 ,
|
|
|
|
.Xr zfs 8 ,
|
|
|
|
.Xr zpool 8
|
|
|
|
.Sh HISTORY
|
|
|
|
.Nm
|
|
|
|
is based on
|
2019-04-03 13:46:43 +00:00
|
|
|
.Xr beadm 1
|
2018-07-24 13:17:40 +00:00
|
|
|
and was implemented as a project for the 2017 Summer of Code, along with
|
|
|
|
.Xr libbe 3 .
|
|
|
|
.Sh AUTHORS
|
2018-08-23 02:09:52 +00:00
|
|
|
.Nm
|
|
|
|
was written by
|
|
|
|
.An Kyle Kneitinger (kneitinger) Aq Mt kyle@kneit.in .
|
2018-07-24 13:17:40 +00:00
|
|
|
.Pp
|
2019-04-03 13:46:43 +00:00
|
|
|
.Xr beadm 1
|
2018-08-23 02:09:52 +00:00
|
|
|
was written and is maintained by
|
|
|
|
.An Slawomir Wojciech Wojtczak (vermaden) Aq Mt vermaden@interia.pl .
|
2018-07-24 13:17:40 +00:00
|
|
|
.Pp
|
2018-08-11 04:01:24 +00:00
|
|
|
.An Bryan Drewery (bdrewery) Aq Mt bryan@shatow.net
|
2018-08-23 02:09:52 +00:00
|
|
|
wrote the original
|
2019-04-03 13:46:43 +00:00
|
|
|
.Xr beadm 1
|
2018-07-24 13:17:40 +00:00
|
|
|
manual page that this one is derived from.
|