You are on page 1of 2

1/5/2011 Solaris Zones Cheat Sheet

Solaris Containers cheat sheet


This a quick cheat sheet of the commands that can be used when using zones (containers), for a more complete
guide see solaris zones.

Zone States

Configuration has been completed and storage has been committed.


Configured
Additional configuration is still required.

Incomplete Zone is in this state when it is being installed or uninstalled.

The zone has a confirmed configuration, zoneadm is used to verify the


configuration, Solaris packages have been installed, even through it
Installed
has been installed, it still has no virtual platform associated with
it.
Zone's virtual platform is established. The kernel creates the zsched
process, the network interfaces are plumbed and filesystems mounted.
Ready (active)
The system also assigns a zone ID at this state, but no processes are
associated with this zone.
A zone enters this state when the first user process is created. This
Running (active)
is the normal state for an operational zone.

Shutting down +
Normal state when a zone is being shutdown.
Down (active)

Files and Directories

zone config file /etc/zones

/etc/zones/index
zone index
Note: used by /lib/svc/method/svc-zones to start and stop zones

Cheat sheet

zonecfg -z <zone>
Creating a zone
see creating a zone for a more details

## halt the zone first, then uninstall it


zoneadm -z <zone> halt
deleting a zone from the zoneadm -z <zone> uninstall
global ssytem
## now you can delete it
zonecfg -z <zone> delete -F

Display zones current


zonecfg -z <zone> info
configuration
Display zone name zonename

Create a zone creation file zonecfg -z <zone> export

Verify a zone zoneadm -z <zone> verify

Installing a zone zoneadm -z <zone> install

Ready a zone
zoneadm -z <zone> ready
datadisk.co.uk/…/solaris_zones_cs.html 1/2
1/5/2011 Solaris Zones Cheat Sheet

boot a zone zoneadm -z <zone> boot

reboot a zone zoneadm -z <zone> reboot

halt a zone zoneadm -z <zone> halt

uninstalling a zone zoneadm -z <zone> uninstall -F

Veiwing zones zoneadm list -cv

login into a zone zlogin <zone>

login to a zones console zlogin -C <zone> (use ~. to exit)

login into a zone in safe mode


zlogin -S <zone>
(recovery)

# pkgadd -G -d . <package>
add/remove a package (global
zone) If the -G option is missing the package will be
added to all zones

# pkgadd -Z -d . <package>
add/remove a package (non-
global zone) If the -Z option is missing the package will be
added to all zones

Query packages in all non-


# pkginfo -Z
global zones

query packages in a specified


# pkginfo -z <zone>
zone

lists processes in a zone # ps -z <zone>

list the ipcs in a zone # ipcs -z <zone>

process grep in a zone # pgrep -z <zone>

list the ptree in a zone # ptree -z <zone>

Display all filesystems # df -Zk

# prstat -Z

# prstat -z <zone>
display the zones process
Note:
informtion
-Z reports information about processes and
zones
-z reports information about a particular zone

datadisk.co.uk/…/solaris_zones_cs.html 2/2

You might also like