beadm - manage ZFS boot environments
beadm create [-a] [-d description] [-e non-activeBeName | beName@snapshot] [-o property=value] ... [-p zpool] beName
beadm create beName@snapshot
beadm destroy [-fF] beName | beName@snapshot beadm destroy [-fF] -O
beadm list [-a | -ds] [-H] [beName]
beadm mount [-b] beName mountpoint
beadm unmount [-f] beName
beadm rename beName newBeName
beadm set-policy {-n [-]policy [-n [-]policy2] ...} beName [beName2 .
beadm activate beName
The beadm command is the user interface for managing ZFS Boot Environments (BEs). This utility is intended to be used by system administrators who want to manage multiple Oracle Solaris instances on a single system.
Using beadm, you can do the following:
Create a new BE, based on the active BE.
Create a new BE, based on an inactive BE.
Create a snapshot of an existing BE.
Create a new BE, based on an existing snapshot.
Create a new BE, and copy it to a different zpool.
Activate an existing, inactive BE.
Mount a BE.
Unmount a BE.
Destroy a BE.
Destroy a snapshot of a BE.
Rename an existing, inactive BE.
Set policy attributes on a set of BEs.
Display information about your snapshots and datasets.
The beadm command has the subcommands and options listed below. Usage of many of these subcommands and options is illustrated in EXAMPLES, below.
Displays command usage.
Creates a new boot environment named beName. If the –e option is not provided, the new boot environment will be created as a clone of the currently running boot environment. If the –d option is provided, then the description is also used as the title for the BE's entry in the GRUB menu for x86 systems or in the boot menu for SPARC systems. If the –d option is not provided, beName will be used as the title. Nested BEs do not support the use of the –p option. Also, non-bootable, nested BEs and snapshots of non-bootable, nested BEs cannot be used with the –e option.
Activate the newly created BE upon creation. The default is to not activate the newly created BE.
Create a new BE with a description associated with it.
Create a new BE from an existing inactive BE. In a nested BE, only bootable BEs can be used with this option.
Create a new BE from an existing snapshot of the BE named beName. In a nested BE, only snapshots of bootable BEs can be used with this option.
Create the datasets for a new BE with specific ZFS properties. Multiple –o options can be specified. See zfs(1M) for more information on the –o option.
Create the new BE in the specified zpool. If this is not provided, the default behavior is to create the new BE in the same pool as the origin BE. This option is not supported inside of a nested BE.
Creates a snapshot of the existing BE named beName. Inside a nested BE, only bootable BEs can be snapshotted. When inside of a nested BE, only BEs that are bootable or BEs that are not bootable but are not marked as active on reboot can be destroyed.
Destroys the boot environment named beName or destroys an existing snapshot of the boot environment named beName@snapshot. Destroying a boot environment will also destroy all snapshots of that boot environment. Use this command with caution.
Forcefully unmount the boot environment if it is currently mounted.
Force the action without prompting to verify the destruction of the boot environment.
Destroy all orphaned boot environments.
Lists information about the existing boot environment named beName, or lists information for all boot environments if beName is not provided. The Flags field indicates whether the boot environment is active now, represented by N; active on reboot, represented by R; or both, represented by NR. Unbootable BEs inside of a nested BE are represented by an exclamation point (!). In such zones, the ! flag means that boot environment's boot artifacts are not resident on the boot pool and, therefore, that BE is NOT directly bootable. (To transfer a BE's boot artifacts to the boot pool, either make the BE activate with the activate subcommand, or change the BE's policy to noevict with the set-policy subcommand). Nested boot environments that have no corresponding global zone boot environment are represented by an O, indicating they are orphaned.
Each line in the machine-parsable output has the boot environment name as the first field. The Space field is displayed in bytes and the Created field is displayed in UTC format. The –H option used with no other options gives the boot environment's UUID in the second field. This field will be blank if the boot environment does not have a UUID. See the EXAMPLES section. Inside of a nested BE, the UUID field actually represents the parent id with which the nested BE is associated.
Lists all available information about the boot environment. This includes subordinate file systems and snapshots.
Lists information about all subordinate file systems belonging to the boot environment.
Lists information about the snapshots of the boot environment.
Do not list header information. Each field in the list information is separated by a semicolon.
Mounts a boot environment named beName at mountpoint. mountpoint must be an already existing empty directory.
If the –b argument is included on the command-line and if there is an active boot pool dataset associated with the specified BE, that boot pool dataset will be mounted under <mountpoint>/bootpool_data (that directory will be automatically created when the dataset is mounted, and automatically removed when the BE is unmounted with the beadm unmount subcommand. Note that unmounting the BE via another mechanism will NOT clean up this created directory.
Unmounts a boot environment named beName.
Forcefully unmount the boot environment even if it is currently busy.
Renames the boot environment named beName to newBeName. In a nested BE, only bootable BEs can be renamed.
Sets (or unsets) the specified set of policies for the specified list of boot environments. Multiple –n arguments are permitted. The policy string specified with –n may begin with a hyphen. If the policy begins with a hypen, that policy is removed from the specified list of boot environments. The current set of supported policies are:
The associated boot environment in the root pool is managed manually and the companion bootable dataset in the boot pool (if an active boot pool exist) is managed by the system).
Same as the static policy for the boot environment's root pool dataset, but the companion bootable dataset in the boot pool (if an active boot pool exists) is created (if it does not already exist) and is never removed, even if the lack of available boot pool space prevents another boot environment's companion bootable dataset from being transferred to the boot pool. NOTE that the boot pool will not be allowed to exceed 85% of its maximum capacity to ensure maximum system performance.
Makes beName the active BE on next reboot. In a nested BE, only bootable BEs can be activated.
beadm supports the concept of a nested BE, specifically, as it pertains to BEs for non-global zones. Currently, beadm can only manage nested BEs from inside of a non-global zone.
beadm functions inside of a non-global zone much the same as it does from the global zone, with a few exceptions. First, the –p (alternate pool) option to beadm create is not supported within a non-global zone. Second, there is a distinction made for any given nested BE (or snapshot of a BE) to determine if it is bootable or not bootable. A nested BE is bootable if it is associated (that is, shares the same parent id as the active global zone BE's UUID) with the currently active global zone BE. It is unbootable—and marked with an '!' in the active column in beadm list)—otherwise. Note that, while the non-global zone administrator could mark such a BE as active by means of beadm activate, rebooting the non-global zone would not result in the BE being loaded, because the BE is associated with a non-active global zone BE. A nested BE is considered orphaned if it is associated with a global zone boot environment that does not exist in this sytem, likely due to zone migration. Based on these conditions, beadm restricts some actions on unbootable BEs thusly:
You cannot destroy a nested BE that is both unbootable and marked as active on reboot, unless the unbootable nested BE is also orphaned.
You cannot activate an unbootable BE.
You cannot snapshot an unbootable BE.
You cannot use an unbootable BE or BE snapshot with the –e option to beadm create.
You cannot rename an unbootable BE.
The following command creates a new BE, BE1, by cloning the current BE.
# beadm create BE1Example 2 Creating a New BE Using Inactive BE
The following command creates a new BE, BE2, by cloning the existing inactive BE named BE1.
# beadm create -e BE1 BE2Example 3 Creating a Snapshot of Existing BE
The following command creates a snapshot named now of the existing BE named BE1.
# beadm create BE1@nowExample 4 Cloning a Snapshot to Create a New BE
The following command creates a new BE named BE3, by cloning an existing snapshot of BE1.
# beadm create -e BE1@now BE3Example 5 Creating a New BE in Specified zpool
The following command creates a new BE named BE4, based on the currently running BE. The command creates the new BE in the zpool rpool2.
# beadm create -p rpool2 BE4Example 6 Creating a New BE in Specified zpool with Compression Enabled
The following command creates a new BE named BE5, based on the currently running BE. The command creates the new BE in the zpool rpool2 and creates its datasets with compression turned on.
# beadm create -p rpool2 -o compression=on BE5Example 7 Creating a New BE and Providing a Description
The following command creates a new BE named BE6, based on the currently running BE, and provides a description for it.
# beadm create -d "BE6 used as test environment" BE6Example 8 Activating a BE
The following command activates an existing, inactive BE named BE3.
# beadm activate BE3Example 9 Mounting a BE
The following command mounts the BE named BE3 at /mnt.
# beadm mount BE3 /mntExample 10 Unmounting a BE
The following command unmounts the BE named BE3.
# beadm unmount BE3Example 11 Destroying a BE
The following command destroys the BE named BE3 without asking for confirmation.
# beadm destroy -F BE3Example 12 Destroying a Snapshot
The following command destroys the snapshot named now of BE1.
# beadm destroy BE1@nowExample 13 Renaming a BE
The following command renames the existing, inactive BE named BE1 to BE3.
# beadm rename BE1 BE3Example 14 Listing All BEs
The following command lists all existing BEs.
# beadm list BE Flags Mountpoint Space Policy Created -- ------ ---------- ----- ------ ------- BE2 - - 72.0K static 2008-05-21 12:26 BE3 - - 332.0K static 2008-08-26 10:28 BE4 - - 15.78M static 2008-09-05 18:20 BE5 NR / 7.25G static 2008-09-09 16:53Example 15 Listing All BEs with Dataset and Snapshot Info
The following command lists all existing BEs and list all dataset and snapshot information about those boot environments.
# beadm list -d -s BE/Dataset/Snapshot Flags Mountpoint Space Policy Created ------------------- ------ ---------- ----- ------ ------- BE2 p/ROOT/BE2 - - 36.0K static 2008-05-21 12:26 p/ROOT/BE2/opt - - 18.0K static 2008-05-21 16:26 p/ROOT/BE2/opt@now - - 0 static 2008-09-08 22:43 p/ROOT/BE2@now - - 0 static 2008-09-08 22:43 BE3 p/ROOT/BE3 - - 192.0K static 2008-08-26 10:28 p/ROOT/BE3/opt - - 86.0K static 2008-08-26 10:28 p/ROOT/BE3/opt/local - - 36.0K static 2008-08-28 10:58 BE4 p/ROOT/BE4 - - 15.78M static 2008-09-05 18:20 BE5 p/ROOT/BE5 NR / 6.10G static 2008-09-09 16:53 p/ROOT/BE5/opt - /opt 24.55M static 2008-09-09 16:53 p/ROOT/BE5/opt@bar - - 18.38M static 2008-09-10 00:59 p/ROOT/BE5/opt@foo - - 18.38M static 2008-06-10 16:37 p/ROOT/BE5@bar - - 139.44M static 2008-09-10 00:59 p/ROOT/BE5@foo - - 912.85M static 2008-06-10 16:37Example 16 Listing Dataset and Snapshot Info for a BE
The following command lists all dataset and snapshot information about BE5.
# beadm list -a BE5 BE/Dataset/Snapshot Flags Mountpoint Space Policy Created ------------------- ------ ---------- ----- ------ ------- BE5 p/ROOT/BE5 NR / 6.10G static 2008-09-09 16:53 p/ROOT/BE5/opt - /opt 24.55M static 2008-09-09 16:53 p/ROOT/BE5/opt@bar - - 18.38M static 2008-09-10 00:59 p/ROOT/BE5/opt@foo - - 18.38M static 2008-06-10 16:37 p/ROOT/BE5@bar - - 139.44M static 2008-09-10 00:59 p/ROOT/BE5@foo - - 912.85M static 2008-06-10 16:37Example 17 Listing in Machine-Parseable Format
The following command lists information about all BEs in machine-parseable format.
# beadm list -H BE2;;;;55296;static;1211397974 BE3;;;;339968;static;1219771706 BE4;;;;16541696;static;1220664051 BE5;215b8387-4968-627c-d2d0-f4a011414bab;NR;/;7786206208;static;1221004384Example 18 Displaying Non-bootable BEs
The following command lists all BEs. When run inside of a non-global zone, it displays both bootable and non-bootable BEs. Non-bootable BEs are designated with an exclamation point (!) in the active column. Orphaned BEs include an O in the active column.
# beadm list BE Active Mountpoint Space Policy Created -- ------ ---------- ----- ------ ------- zbe-0 !RO - 29.22M static 2011-03-04 09:14 zbe-1 NR / 815.10M static 2011-03-04 09:28 zbe-2 - - 35.0K static 2011-03-04 09:28 zbe-3 - - 35.0K static 2011-03-04 09:28 zbe-4 - - 35.0K static 2011-03-04 09:28 zbe-5 ! - 35.0K static 2011-03-04 11:47 zbe-6 !R - 54.0K static 2011-03-07 14:37Example 19 Setting policy flags for a set of boot environments
The following command sets the noevict attribute for BEs named BE1, BE2, and BE3 (and transfers boot artifacts from BE1, BE2, and BE3 to the boot pool):
# beadm set-policy -n noevict BE1 BE2 BE3 # beadm list BE Flags Mountpoint Space Policy Created -- ----- ---------- ----- ------ ------- BE1 - - 6.13M noevict,static 2014-10-20 09:14 BE2 NR / 52.86M noevict,static 2014-10-21 04:33 BE3 - - 559.0K noevict,static 2014-10-22 01:59 BE4 !- - 313.1M static 2014-10-22 04:19
The following command clears the noevict attribute (by setting the list of attributes to a value that does not include it):
# beadm set-policy -n -noevict BE2 # beadm list BE Flags Mountpoint Space Policy Created -- ----- ---------- ----- ------ ------- BE1 - - 6.13M noevict,static 2014-10-20 09:14 BE2 NR / 52.86M static 2014-10-21 04:33 BE3 - - 559.0K noevict,static 2014-10-22 01:59 BE4 !- - 313.1M static 2014-10-22 04:19
Success.
Failure.
Log used for capturing beadm create output. The time designation portion of the file name is explained as follows.
yyyymmdd_hhmmss — for example, 20071130_140558.
yyyy — year, 2007
mm — month, 11
dd — day, 30
hh — hour, 14
mm — minute, 05
ss — second, 58
See attributes(5) for descriptions of the following attributes:
|