How to Clone zones in Solaris 10
How to clone a zone
1. Login as a super user
# su root
2. Look how many zones are install on the system
# zoneadm list -vc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
2 zone1 running /zones/zone1 native shared
3. Now we need to clone the zone ‘zone1’
# zoneadm -z zone1 halt
# zoneadm list -vc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– zone1 installed /zones/zone1 native shared
We can see from above command that zone has been halted.
4. Now next step is to export the source of zone1 to a new file say suppose master.
# zonecfg -z zone1 export -f /zones/master
Look at the master file
# cd /zones
# more master
create -b
set zonepath=/zones/zone1
set autoboot=true
set ip-type=shared
add inherit-pkg-dir
set dir=/lib
end
add inherit-pkg-dir
set dir=/platform
end
add inherit-pkg-dir
set dir=/sbin
end
add inherit-pkg-dir
set dir=/usr
end
add net
set address=192.168.9.173
set physical=eri0
end
In this we need to change some configuration like IPaddress and the path name of the zone.
# vi master
create -b
set zonepath=/zones/master
set autoboot=true
set ip-type=shared
add inherit-pkg-dir
set dir=/lib
end
add inherit-pkg-dir
set dir=/platform
end
add inherit-pkg-dir
set dir=/sbin
end
add inherit-pkg-dir
set dir=/usr
end
add net
set address=192.168.9.174
set physical=eri0
end
We edited the master file , change the path and ipaddress.
5. Now create the new zone zone2 using master file
# zonecfg -z zone2 -f /zones/master
Clone the zone1 to zone2
6. Install the new zone ‘zone2’ using zone1
# zoneadm -z zone2 clone zone1
Cloning zonepath /zones/zone1…
# zoneadm list -vc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– zone1 installed /zones/zone1 native shared
– zone2 installed /zones/zone2 native shared
7. Next step is to boot zone1 and zone2
# zoneadm -z zone1 boot
# zoneadm -z zone2 boot
# zoneadm list -vc
ID NAME STATUS PATH BRAND IP
0 global running / native shared
4 zone1 running /zones/zone1 native shared
5 zone2 running /zones/zone2 native shared

Leave a Reply