How to Install and Deploy Zones by Cloning
This procedure describes how to clone a source zone to install new zones.
Example 2-3 Creating Multiple Zones From a Source Zone
This example shows how to create three non-global zones from zoneA
:
-
Three zones to be created are
zone0
,zone1
, andzone2
. -
The
zonepath
ofzoneA
is defined. Thus, this parameter needs to be adjusted for each new zone. -
Each zone has a corresponding configuration profile (
/var/tmp/
zonename.xml
) to be used at installation time.
Shut down the zone if necessary. global$ zoneadm -z zoneA shutdown global$ zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / solaris shared zoneA installed /zones/zonea solaris exclusive Export the configuration. global$ zonecfg -z zoneA export -f /var/tmp/zoneA.txt global$ cat /var/tmp/zoneA.txt create -b set brand=solaris set zonepath=/zones/zonea set autoboot=true
Edit /var/tmp/zoneA.txt
to set zonepath
to /zones/zone0
. Then configure zone0
with /var/tmp/zoneA.txt
.
global$ zonecfg -z zone0 -f /var/tmp/zoneA.txt global$ zonecfg -z zone0 info zonename: zone0 brand: solaris zonepath: /zones/zone0specific to zone0 autoboot: true
For each of the remaining zone, repeat editing the zonepath
and configuring the zone. After all the new zones are configured, they will be listed as being in the configured
state.
global$ zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
zoneA installed /zones/zonea solaris exclusive
zone0 configured /zones/zone0 solaris exclusive
zone1 configured /zones/zone1 solaris exclusive
zone2 configured /zones/zone2 solaris exclusive
Clone the source zone to create the three zones.
global$ zoneadm -z zone0 clone -c /var/tmp/zone0.xml zoneA global$ zoneadm -z zone1 clone -c /var/tmp/zone1.xml zoneA global$ zoneadm -z zone2 clone -c /var/tmp/zone2.xml zoneA global$ zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / solaris shared zoneA installed /zones/zonea solaris exclusive zone0 installed /zones/zone0 solaris exclusive zone1 installed /zones/zone1 solaris exclusive zone2 installed /zones/zone2 solaris exclusive global$ zoneadm -z zone0 boot global$ zoneadm -z zone1 boot global$ zoneadm -z zone2 boot global$ zoneadm list -cv ID NAME STATUS PATH BRAND IP 0 global running / solaris shared zoneA installed /zones/zonea solaris exclusive 1 zone0 running /zones/zone0 solaris exclusive 2 zone1 running /zones/zone1 solaris exclusive 3 zone2 running /zones/zone2 solaris exclusive
Creating a Source Zone
As an option, you can create a zone solely for use as a source to provision new zones. Configure the zone's global properties with settings that remain stable and universally applicable, such as autoboot
and so on. You can also explicitly specify its brand so you know to use this source to install other zones of the same brand. Make sure to name the zone in a way to easily identify it as only a source zone. The zone would not be booted to prevent its being used.