Creating and Using Oracle Solaris Kernel Zones

Exit Print View

Updated: December 2014

Cloning a Kernel Zone

Cloning enables you to copy an existing configured and installed zone on your system to a new zone on the same system. The cloned zone includes any customizations of the existing zone. For example, added packages, modified zone resources, and file modifications on the source zone will appear in each cloned zone. Cloning a zone is an efficient way to add additional zones with a similar customized zone configuration.

You can clone a kernel zone in the following ways:

After a kernel zone is cloned, you can boot and log in to the new zone.

Example 2-4  Cloning a Kernel Zone by Using the zoneadm clone Command.

This example demonstrates how to clone the kernel zone kzone1 to the kernel zone kzone2 on the host global. For a step-by-step procedure, see Cloning a Non-Global Zone on the Same System in Creating and Using Oracle Solaris Zones .

global# zoneadm -z kzone1 halt
global# zonecfg -z kzone2 create -t kzone1
global# zoneadm -z kzone2 clone kzone1
Progress being logged to /var/log/zones/zoneadm.20140327T223951Z.kzone2.clone
Install Log: /system/volatile/install.100847/install_log
 AI Manifest: /system/shared/ai.xml
Installation: Starting ...

        Creating direct clone image...
        Registering dynamic archive transfer
        Pre-validating manifest targets before actual target selection
        Pre-validation of manifest targets completed
        Validating combined manifest and archive origin targets
        Commencing transfer of stream: ...
        Completed transfer of direct stream: ...
        Archive transfer completed
Installation: Succeeded
Example 2-5  Cloning and Deploying a Kernel Zone by Using a Unified Archive

The following example demonstrates cloning and deploying the kernel zone kzone1 by using the archiveadm command. A Unified Archive is created for the kernel zone kzone1. The archive info is verified and the kernel zone kzone2 is cloned with the modified zone configuration from kzone1. For a step-by-step procedure, please see Using Unified Archives for System Recovery and Cloning in Oracle Solaris 11.2 .

global# archiveadm create -z kzone1 /var/tmp/kzone1.uar
Unified Archive initialized: /var/tmp/kzone1.uar.                                                                  \
Logging to: /system/volatile/archive_log.26248
Dataset discovery completed...                                                                                      /
Media creation complete for zone(s)...                                                                               -
Archive stream creation completed...                                                                                -
Archive creation completed... 
global# zoneadm list -cv
  ID NAME             STATUS      PATH                         BRAND      IP
   0 global           running     /                            solaris    shared
   2 kzone1           running     -                            solaris-kz excl
global# archiveadm info /var/tmp/kzone1.uar
Archive Information
          Creation Time:  2014-04-10T17:12:12Z
            Source Host:  global
           Architecture:  i386
       Operating System:  Oracle Solaris 11.2 X86
      Deployable Systems: kzone1
global# zonecfg -z kzone2 create -a /var/tmp/kzone1.uar
global# zoneadm -z kzone2 install -a /var/tmp/kone1.uar
global# zoneadm list -cv
  ID NAME             STATUS      PATH                         BRAND      IP
   0 global           running     /                            solaris    shared
   2 kzone1           running     -                            solaris-kz excl
   - kzone2           configured  -                            solaris-kz excl