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 exist in each clone. Cloning a zone is an efficient way to add additional zones that have similar requirements.
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 27, Cloning a Kernel Zone by Using the zoneadm clone Command..
Use a Unified Archive file if you need to clone multiple zones for a large deployment. See Example 28, Cloning and Deploying a Kernel Zone by Using a Unified Archive.
After a kernel zone is cloned, you can boot and log in to the new zone.Example 27 Cloning a Kernel Zone by Using the zoneadm clone Command.
The following example demonstrates how to clone the kernel zone kzone1 to the kernel zone kzone2 on the host system global.
global$ pfbash 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: SucceededExample 28 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 information is verified and the kernel zone kzone2 is cloned with the modified zone configuration from kzone1. For a step-by-step procedure, see Using Unified Archives for System Recovery and Cloning in Oracle Solaris 11.4.
global$ pfbash 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/kzone1.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