Solaris zones

In this example, I create, boot, and configure a sparse zone named osummdo001.

# zonecfg -z osummdo001
osummdo001: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:osummdo001> create

By default, the zone will not boot when the global zone (system) boots, so I change that behavior.

zonecfg:osummdo001> set autoboot=true

According to the System Administration Guide: Solaris Containers-Resource Management and Solaris Zones (November 2006), the zonepath should not be on ZFS.

zonecfg:osummdo001> set zonepath=/osummdo001/root

The ZFS dataset zfspool/osummdo001/oracle will be made available as /files0/oracle within the zone.

zonecfg:osummdo001> add fs
zonecfg:osummdo001:fs> set dir=/files0/oracle
zonecfg:osummdo001:fs> set special=/zfspool/osummdo001/oracle
zonecfg:osummdo001:fs> set type=lofs
zonecfg:osummdo001:fs> end

I add a network interface to the zone.

zonecfg:osummdo001> add net
zonecfg:osummdo001:net> set physical=dmfe0
zonecfg:osummdo001:net> set address=192.168.1.100
zonecfg:osummdo001:net> end

Next, I verify the zone's configuration, and install the zone.

# zoneadm -z osummdo001 verify

# zoneadm -z osummdo001 install
Preparing to install zone <osummdo001>.
Creating list of files to copy from the global zone.
Copying <8726> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <297> packages on the zone.
Initialized <297> packages on zone.                               
Zone <osummdo001> is initialized.
Installation of these packages generated errors: <SUNWkvm SUNWesu SUNWkrbr SUNWkrbu SUNWib SUNWipoib SUNWtavor SUNWudapltu SUNWudapltr SUNWusb SUNWusbs SUNWuedg SUNWugen SUNWuksp SUNWopenssl-libraries SUNWwbsup SUNWuprl SUNWvolr SUNWnfscr SUNWnfscu SUNWvolu SUNWrcmdc SUNWscpu SUNWxge SUNWsmapi SUNWmdr SUNWmdu SUNWses SUNWssad SUNWintgige SUNWipfr SUNWipfu SUNWkey SUNWdfbh SUNWdtrc SUNWdtrp SUNWpd SUNWrpcib>
Installation of <1> packages was skipped.
The file </osummdo001/root/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

I then boot the zone, and login on the zone's console to complete zone system identification.

# zoneadm -z osummdo001 boot
# zlogin -C osummdo001

Adding a file system to a zone

In this example, I add a ZFS file system named /oradata1 to the osummdo001 zone.

First, I create the ZFS file system in the global zone.

# zfs create zfspool/osummdo001/oradata1

Next, I add the file system to the zone's configuration.

# zonecfg -z osummdo001
zonecfg:osummdo001> add fs
zonecfg:osummdo001:fs> set dir=/oradata1
zonecfg:osummdo001:fs> set special=/zfspool/osummdo001/oradata1
zonecfg:osummdo001:fs> set type=lofs
zonecfg:osummdo001:fs> end
zonecfg:osummdo001> commit
zonecfg:osummdo001> end

The above commit is unnecessary, as the changes would have automatically been committed when typing end.

As of this writing, I do not know of any way to add the file system to a running zone. Rebooting the zone will cause the file system to be added to the zone.

# zoneadm -z osummdo001 reboot

More information:
Solaris Zone Management

Back to brandonhutchinson.com.
Last modified: 2007/06/08