OpenSolaris Managing Boot Environments
Previous Next

Creating a Boot Environment

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 inactive and displays as an alternate in the GRUB menu for x86 systems or the boot menu for SPARC systems on reboot. The SPARC boot menu is located at /rpool/boot/menu.lst.


Note - When you create a new boot environment, the process first automatically takes a snapshot of the original boot environment, then the process makes a new clone that is derived from this snapshot. Both the new snapshot and the new clone are retained by the system.


How to Create a Boot Environment

  1. At the command line, type the following:
    $ 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.


  2. (Optional) You can use the beadm mount command to mount the new boot environment as follows:
    $ beadm mount beName mountpoint

    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.


    Note - Unmount the boot environment before rebooting.


  3. (Optional) If you want to boot to this new boot environment, use the following command to activate the 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 mostly recently activated boot environment as the default.


Example 2-3 Creating a New, Cloned Boot Environment with Datasets (BE2)

The following example illustrates the datasets in a newly created boot environment.

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 or /opt, then those datasets are also cloned.

rpool/ROOT/BE1
rpool/ROOT/BE1/usr
rpool/ROOT/BE1/var
rpool/ROOT/BE1/opt
rpool/ROOT/BE2
rpool/ROOT/BE2/usr
rpool/ROOT/BE2/var
rpool/ROOT/BE2/opt

rpool in this example is the name of the storage pool. The pool already exists on the system, previously set up by the initial installation or upgrade. 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 2-4 Creating a New Boot Environment With Shared Datasets

The following example illustrates a newly-created boot environment that has shared datasets.

Shared datasets are user-defined files, such as /export, that contain the same mount point in both the active and inactive boot environments. Shared datasets are located outside the root dataset area of each boot environment.

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/<BE> 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/usr
rpool/ROOT/BE1/var
rpool/ROOT/BE1/opt
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/usr
rpool/ROOT/BE2/var
rpool/ROOT/BE2/opt
rpool/export
rpool/export/home

How to Create a Boot Environment From an Inactive Boot Environment

By default, a new boot environment is created from the active boot environment. However, you can use the beadm create command to create a new boot environment that is based on an existing, inactive boot environment.

  1. Become superuser or assume an equivalent role.
  2. To create a new, inactive BE from an existing, inactive boot environment, type the following command:
    $ beadm create -e non-activeBeName beName

    non-activeBeName is a variable for the existing inactive BE that is cloned by this command.

    beName is the variable for the new BE name.

    By default, the new boot environment is inactive.

Previous Next