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:
- Use the zoneadm clone command if you need to clone a small number of zones. See Example 1.
- Use a Unified Archive file if you need to clone multiple zones for a large deployment, such as in a data center environment. See Example 2.
Note - A Unified Archive file can include only kernel zones that are in the running state. During Unified Archive creation, you can exclude any kernel zones that are not running. See Chapter 2, Working With Unified Archives, in Using Unified Archives for System Recovery and Cloning in Oracle Solaris 11.2 for more information.
After a kernel zone is cloned, you can boot and log in to the new zone.
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 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
No comments:
Post a Comment