Go to main content

Creating and Administering Oracle® Solaris 11.3 Boot Environments

Exit Print View

Updated: December 2017
 
 

Examples of Cloning Boot Environments

The following examples illustrate how to clone boot environments, and how the cloning process varies depending on the zone and dataset structure. The first example illustrates how cloning operates in a system that includes global and non-global zones. The second example shows dataset specifics related to cloning. The third example show what happens with shared datasets when you clone a system.


Note - For zones and dataset information, see the following:
Example 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 you are cloning a boot environment in a global zone that contains non-global zones.

If the boot environment being cloned has an associated zone boot environment in a non-global zone, that associated boot environment is also cloned. For example, BE1 has an associated zone boot environment, BE2, in a non-global zone. If BE1 is cloned, BE2 is also cloned.

  • In this example, the original boot environment in the global zone is named solaris with its root dataset at rpool/ROOT/solaris.

  • A non-global zone named z1 exists that has the dataset rpool/zones/z1 as its zonepath. The original solaris boot environment in the global zone has an associated boot environment in the z1 non-global zone. This associated zone boot environment is named solaris, with a root dataset at rpool/zones/z1/rpool/ROOT/solaris.

# zfs list -r rpool
NAME                                    USED  AVAIL  REFER MOUNTPOINT
rpool                                  11.5G  3.89G  4.46M  /rpool
rpool/ROOT                             8.47G  3.89G    31K  legacy
rpool/ROOT/solaris                     2.98M  3.89G  2.49G  /
rpool/ROOT/solaris/var                  428K  3.89G   298M  /var
rpool/dump                             1.03G  3.92G  1.00G  -
rpool/export                            120K  3.89G    32K  /export
rpool/export/home                      88.5K  3.89G    32K  /export/home
rpool/export/home/user1                56.5K  3.89G  56.5K  /export/home/user1
rpool/swap                             1.03G  3.92G  1.00G  -
rpool/zones                             672M  3.89G    32K  /zones
rpool/zones/z1                          672M  3.89G    32K  /zones/z1
rpool/zones/z1/rpool                    671M  3.89G    31K  /rpool
rpool/zones/z1/rpool/ROOT               671M  3.89G    31K  legacy
rpool/zones/z1/rpool/ROOT/solaris       671M  3.89G   591M  /zones/z1/root
rpool/zones/z1/rpool/ROOT/solaris/var  79.3M  3.89G  78.4M  /zones/z1/root/var
rpool/zones/z1/rpool/export              62K  3.89G    31K  /export
rpool/zones/z1/rpool/export/home         31K  3.89G    31K  /export/home

In this example, you would issue the following command as root to clone the boot environment in the global zone and name the new boot environment solaris-1:

# beadm create test
# zfs list -r rpool
NAME                                      USED  AVAIL  REFER MOUNTPOINT
rpool                                    11.5G  3.89G  4.46M  /rpool
rpool/ROOT                               8.47G  3.89G    31K  legacy
rpool/ROOT/solaris                       2.98M  3.89G  2.49G  /
rpool/ROOT/solaris/var                    428K  3.89G   298M  /var
rpool/ROOT/test                           71K  3.89G  2.50G  /
rpool/ROOT/test/var                        1K  3.89G  2.88G  /var
rpool/dump                               1.03G  3.92G  1.00G  -
rpool/export                              120K  3.89G    32K  /export
rpool/export/home                        88.5K  3.89G    32K  /export/home
rpool/export/home/user1                  56.5K  3.89G  56.5K  /export/home/user1
rpool/swap                               1.03G  3.92G  1.00G  -
rpool/zones                               672M  3.89G    32K  /zones
rpool/zones/z1                            672M  3.89G    32K  /zones/z1
rpool/zones/z1/rpool                      671M  3.89G    31K  /rpool
rpool/zones/z1/rpool/ROOT                 671M  3.89G    31K  legacy
rpool/zones/z1/rpool/ROOT/solaris         671M  3.89G   591M  /zones/z1/root
rpool/zones/z1/rpool/ROOT/solaris/var    79.3M  3.89G  78.4M  /zones/z1/root/var
rpool/zones/z1/rpool/ROOT/solaris-1        2K  3.89G   591M  /
rpool/zones/z1/rpool/ROOT/solaris-1/var    1K  3.89G  78.4M  /var
rpool/zones/z1/rpool/export                62K  3.89G    31K  /export
rpool/zones/z1/rpool/export/home           31K  3.89G    31K  /export/home
  

The clone is named test, with a root dataset at rpool/ROOT/test.

Note that because the solaris boot environment in the global zone has an associated zone boot environment in the z1 non-global zone, the cloning process also clones the associated zone boot environment in z1. The new solaris-1 clone in zone z1 has its root dataset at rpool/zones/z1/rpool/ROOT/solaris-1.

Example 2  Cloning a New Boot Environment with Datasets

This example illustrates how datasets are set up in a newly created boot environment. This example does not involve multiple zones.

As root, you would type the following command.

# beadm create BE2

The original boot environment in this example is BE1 with a root dataset at rpool/ROOT/BE1 containing another dataset, var.

# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
rpool                     42.5G  24.4G  4.65M  /rpool
rpool/ROOT                25.6G  24.4G    31K  legacy
rpool/ROOT/BE1            8.91M  24.4G  4.17G  /
rpool/ROOT/BE1/var        3.96M  24.4G   276M  /var

After BE1 is cloned, the new clone, BE2, contains a root dataset and other nested datasets, all cloned from BE1. Because BE1 contains the /var file system under the root dataset, /var was also cloned.

# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
rpool                     42.5G  24.4G  4.65M  /rpool
rpool/ROOT                25.6G  24.4G    31K  legacy
rpool/ROOT/BE1            8.91M  24.4G  4.17G  /
rpool/ROOT/BE1/var        3.96M  24.4G   276M  /var
rpool/ROOT/BE2            8.91M  24.4G  4.17G  /
rpool/ROOT/BE2/var        3.96M  24.4G   276M  /var

In contrast, if there was a shared file system outside of the root dataset, that shared file system would not have been cloned. The original boot environment and the clone would both "share" the original shared file system, as shown in the next example.

Example 3  Creating a New Boot Environment With Existing Shared Datasets

This example illustrates creating a new boot environment when there are existing shared datasets. In this example, the original boot environment is BE1, and the shared datasets are rpool/export and rpool/export/home. This example does not involve multiple zones.

As root, you would type the following command to clone BE1 and name the clone BE2:

# beadm create BE2

The shared datasets, tank and tank/export, 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, BE2.

The original boot environment, BE1, and datasets are as follows:

# zfs list
NAME                      USED  AVAIL  REFER  MOUNTPOINT
rpool                    42.5G  24.4G  4.65M  /rpool
rpool/ROOT               25.6G  24.4G    31K  legacy
rpool/ROOT/BE1           8.91M  24.4G  4.17G  /
rpool/ROOT/BE1/var       3.96M  24.4G   276M  /var
tank                      450K   457G    18K  /tank
tank/home                 315K   457G    21K  /tank/home

The root dataset is at rpool/ROOT/BE1 and a /var dataset is located under the root dataset. The root dataset and /var are both cloned.

The cloned boot environment, BE2, has new root dataset and a new /var dataset, but the original shared datasets, tank and tank/home, are unchanged.

# zfs list
NAME                      USED  AVAIL  REFER  MOUNTPOINT
rpool                    42.5G  24.4G  4.65M  /rpool
rpool/ROOT               25.6G  24.4G    31K  legacy
rpool/ROOT/BE1           8.91M  24.4G  4.17G  /
rpool/ROOT/BE1/var       3.96M  24.4G   276M  /var
rpool/ROOT/BE2           8.91M  24.4G  4.17G  /
rpool/ROOT/BE2/var       3.96M  24.4G   276M  /var
tank                      450K   457G    18K  /tank
tank/home                 315K   457G    21K  /tank/home