Skip Navigation Links | |
Exit Print View | |
Creating and Administering Oracle Solaris 11 Boot Environments Oracle Solaris 11 Information Library |
1. Introduction to Managing Boot Environments
3. Creating Boot Environments and Snapshots
Creating and Copying Snapshots
Creating a Snapshot of a Boot Environment
Creating a Boot Environment From an Existing Snapshot
If you want to create a backup of an existing boot environment, for example, prior to modifying the original boot environment, you can use the beadm command to create and mount a new boot environment that is a clone of your active boot environment. This clone is listed as an alternate boot environment in the GRUB menu for x86 systems or in the boot menu for SPARC systems.
When you clone a boot environment by using the beadm create command, all supported zones in that boot environment are copied into the new boot environment.
The beadm create command has the following options, where BeName specifies the name of the boot environment to be created.
Syntax: beadm create [-a] [-d description] [-e non-activeBeName | BeName@snapshot] [-o property=value]...[-p zpool] BeName
-a – Activate the newly created boot environment upon creation. The default is to not activate the newly created boot environment.
-d description – Enter a custom description as the title in the x86 GRUB menu or the SPARC boot menu to describe the new boot environment. If this option is not used, BeName is used for the title.
-e non-activeBeName – Create a new boot environment from a specified existing, but inactive, boot environment. The default is to create the boot environment from the active boot environment.
-e BeName@snapshot – Create a new boot environment from a specified, existing snapshot of the boot environment.
-o property=value – Create the datasets for a new boot environment with specific ZFS properties. Multiple -o options can be specified. See the zfs(1M) man page for more information on the -o option.
-p zpool – Create the datasets for a new boot environment within a specified zpool. If this option is not provided, the default behavior is to create the new boot environment in the same pool as the original boot environment. The -p option is not supported within a non-global zone.
Note - The -p option can be combined with the other options.
# beadm create BeName
BeName is a variable for the name of the new boot environment. This new boot environment is inactive.
Note - beadm create does not create a partial boot environment. The command either successfully creates a full boot environment, or the command fails.
# beadm mount BeName mount-point
Note - If the directory for the mount point does not exist, the beadm utility creates the directory, then mounts the boot environment on that directory.
If the boot environment is already mounted, the beadm mount command fails and does not remount the boot environment at the newly specified location.
The boot environment is mounted but remains inactive. You can upgrade a mounted, inactive boot environment.
# beadm activate BeName
BeName is a variable for the name of the boot environment to be activated.
On reboot, the newly active boot environment is displayed as the default selection in the x86 GRUB menu or the SPARC boot menu.
Note - The GRUB menu or boot menu always displays the most recently activated boot environment as the default.
The following examples illustrate how to create boot environments, and how the creation process varies depending on the zone and dataset structure.
Note - For zones and dataset information, see the following:
Example 3-1 Cloning a Boot Environment in a Global Zone That Contains Non-Global Zones
This example shows the zones impact of the beadm create command when cloning a boot environment that contains two non-global zones.
The original boot environment in the global zone is named solaris with the root dataset at rpool/ROOT/solaris.
A zone named z1 exists that has the dataset rpool/zones/z1 as its zonepath. The original boot environment in the global zone has a copy of this zone's root dataset at rpool/zones/z1/rpool/ROOT/solaris.
Become the root role, and perform the following command to clone the boot environment and name the new boot environment solaris-1:
# beadm create solaris-1
The root dataset for the new boot environment is at rpool/ROOT/solaris-1. The copy of zone z1 for the new boot environment has its root dataset at rpool/zones/z1/rpool/ROOT/solaris-1.
Example 3-2 Creating a New, Cloned Boot Environment with Datasets
This example illustrates how datasets are set up in a newly created boot environment.
Become the root role and type the following command.
# beadm create BE2
The original boot environment in this example is BE1. The new boot environment, BE2, contains separate datasets cloned from BE1. If BE1 contains separate datasets for traditional file systems, such as /var, then those datasets are also cloned.
rpool/ROOT/BE1 rpool/ROOT/BE1/var
rpool/ROOT/BE2 rpool/ROOT/BE2/var
rpool in this example is the name of the storage pool. The pool was previously set up by the initial installation or upgrade and, therefore, already exists on the system. ROOT is a special dataset that was also created previously by the initial installation or upgrade. ROOT is reserved exclusively for use by boot environment roots.
Example 3-3 Creating a New Boot Environment With Shared Datasets
This example illustrates a new boot environment that has shared datasets.
Become the root role and type the following command:
# beadm create BE2
The shared datasets, rpool/export and rpool/export/home, are not cloned when the boot environment is cloned. The shared datasets are located outside the rpool/ROOT/<BeName> datasets and are referenced at their original locations by the cloned boot environment.
The original boot environment, BE1, and datasets are as follows:
rpool/ROOT/BE1 rpool/ROOT/BE1/var rpool/export rpool/export/home
The cloned boot environment, BE2, has new root datasets but the original shared datasets, rpool/export and rpool/export/home, are unchanged.
rpool/ROOT/BE2 rpool/ROOT/BE2/var rpool/export rpool/export/home