This document explains how to perform the most essential tasks associated with managing Solaris 10 zones.
Listing zones
Zones can be listed using the zoneadm list -v command in Solaris 10. You can also look inside the zone index file and xml files for individual zones to see the settings.
cat /etc/zones/index
global:installed:/
[zone name]:installed:/zones/[zone name]
cat /etc/zones/[zone name].xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE zone PUBLIC "-//Sun Microsystems Inc//DTD Zones//EN"
"file:///usr/share/lib/xml/dtd/zonecfg.dtd.1" >
<zone name="[zone name]" zonepath="/zones/[zone name]"
autoboot="true">
<network address="x.x.x.x" physical="eri0"/>
</zone>
Zone creation
This will create a full zone. To create a sparse zone omit the –b from the create command.
zonecfg -z [zone name]
zonecfg:my-zone> create -b
zonecfg:my-zone> set zonepath=/zones/[zone name]
zonecfg:my-zone> add net
zonecfg:my-zone:net> set address=x.x.x.x
zonecfg:my-zone:net> set physical=eri0
zonecfg:my-zone:net> end
zonecfg:my-zone> verify
zonecfg:my-zone> commit
zonecfg:my-zone> ^D
zoneadm -z [zone name] install
zoneadm -z [zone name] boot
zlogin -C [zone name]
Zone backup
The script takes a flash archive of the zone files and then moves them into a .tar.gz file. Zones cannot be copied using a regular cp or mv. It also strips out some configuration into a separate file which can be used for migration.
/usr/bin/zonebkp
Usage: zonebkp [OPTION]
[-h] Prints this help text.
-l Lists zones for backup.
-t Tests only, without backup.
-v Verbose mode.
-b zonename[,zonename...]
Backups specified zones.
-d backupdir Location of backup. Default is /var/tmp
Example : zonebkp –b transact –d /zones/backup/full
Download zonebkp and zonebkpfunctions.
Zone restore
mkdir /zones/[zone name]
chmod 700 /zones/[zone name]
cd /zones/[zone name]
gzip –dc /zones/backup/full/BackupFileName.tar.gz | tar xvf –
vi /etc/zones/index (add an entry for the new zone)
vi /etc/zones/[zone name].xml (add config for zone)
zoneadm –z [zone name] boot
Zone duplication
Backup the zone using the procedure outlined above
Restore the zone using the procedure outlined above. However use a different [zone name] and modify the files in /etc/zones to reflect the new name, network address and zonepath.
zlogin [zone name]
sys-unconfig
zlogin –C [zone name]
Choose option 4 for the locale and set the required hostname and network settings
Zone deletion
zlogin [zone name] shutdown –i0 –g0 –y
zoneadm –z [zone name] uninstall
rm –r /zones/[zone name]
Forcefully killing a zone
zoneadm –z [zone name] halt
