Solaris 10 Zone

Every Solaris 10 system contains a global zone. The global zone is the Solaris operating system instance. After installing Solaris 10 on a system, if no non-global zones are created, all processes run in the global zone.

Three commands use for Solaris 10 Zone:
zonecfg – set up zone configuration.
zoneadm – administer zones (install zone)
zlogin – set up zone host parameters (using -C option)

Two model of Solaris 10 non-global zone:
The default is sparse-root and the second model is whole-root zone

Sparse-root zones optimize physical memory and disk space usage by sharing some directories with the global zone. Read-only loopback file systems, identified as inherit-pkg-dir resources, are used to gain access to other files. It inherit /lib, /platform, /sbin, and /usr. It has its own /etc and /var.

Whole-root zone is use for configuration flexibility but increases resource usage. whole-root zone Do NOT use shared file systems for /lib, /platform, /sbin, and /usr

Packages have parameters that control how their content is distributed and made visible on a system with non-global zones installed. The parameters are set to true or false.

SUNW_PKG_ALLZONES defines the zone scope of a package. The scope determines the type of zone (global or non-global) in which an individual package can be installed.

SUNW_PKG_HOLLOW defines the visibility of a package if that package is required to be installed on all zones and be identical in all zones.

SUNW_PKG_THISZONE defines whether a package must be installed in the current zone only.

pkgparam can be used to view the values for these parameters. Packages that do not define values for zone package parameters have a default setting of false.

# pkgparam CSWpuppet3 SUNW_PKG_ALLZONES=true

Solaris 10 Zone Usage Examples

global# zonecfg -z newzone
zonecfg:newzone> create
# Use "create -b" for whole-root zone
zonecfg:newzone> set zonepath=/export/home/newzone

zonecfg:newzone> add net     # Optional
zonecfg:newzone:net> set address=
zonecfg:newzone:net> set physical=e1000g0
zonecfg:newzone:net> end

# Sparse zone only
zonecfg:newzone> add inherit-pkg-dir
zonecfg:newzone:inherit-pkg-dir> set dir=/opt/sfw
zonecfg:newzone:inherit-pkg-dir> end

zonecfg:newzone> set autoboot=true
zonecfg:newzone> verify
zonecfg:newzone> commit
zonecfg:newzone> exit

Viewing a Zone Configuration

global# zonecfg -z newzone
zonecfg:newzone> info

Install and Boot the zone

global# zoneadm -z newzone install
global# zoneadm -z newzone boot

# List the zone status
global# zoneadm list -vi

Loging to the newzone and perform initial setup

global# zlogin -C newzone

Halting, Uninstalling, Moving, and Cloning Zones

# Halting:
global# zoneadm -z newzone halt

# Uninstalling:
global# zoneadm -z newzone uninstall

# Moving:
global# zoneadm -z newzone move /zones/zone_roots/newzone

# Cloning:
global# zoneadm -z zone2 clone zone1

Deleting a Zone

global# zlogin newzone shutdown
global# zoneadm -z newzone uninstall -F
global# zonecfg -z newzone delete -F
global# zoneadm list -iv