Professional Documents
Culture Documents
Solaris Zones: Create Zone List Zones
Solaris Zones: Create Zone List Zones
Zones are virtual process environments in Solaris 10 (and newer) that allow system administrator to isolate process in one zone from processes in another zone. Zones have their own (chroot) storage environment which again separates data between zones.
the zoneadm -z zone boot command on a zone in the running state will have the zone be booted into the running state
Create zone
Create sparse root model zone (default) zonecfg -z zone zonecfg:zone> create Create whole root model zone zonecfg -z zone zonecfg:zone> create -b Create zone using custom template zonecfg -z zone -f template.zone
List zones
List available zones zoneadm list -cv Look at zone configuration zonecfg -z zone info Check current zone zonename
This quick reference list the most commonly used commands involved managing Solaris zones. For a zones overview see the solaris_zones_intro quick reference at http://www2.petervg.nl/quick_reference
Zone states
Undefined zonecfg -z zone zone: > create zonecfg -z zone delete Configured zoneadm -z zone install zoneadm -z uninstall Installed zoneadm -z zone ready Ready zoneadm -z zone boot zoneadm -z zone halt
Manage zone
Create zone's root file system structure zoneadm -z zone install Boot zone in ready mode zoneadm -z zone ready Into running mode zoneadm -z zone boot Reboot zone(from global zone) zoneadm -z zone boot Halt zone (from global zone) This will not run the shutdown procedures!! zoneadm -z zone halt Reboot zone (from global zone) This will not run the shutdown procedures zoneadm -z zone reboot Backup zone configuration zonecfg -z zone -f /backup/zone.cmd
A running zone cannot be brought back to the ready state. A halt on a running zone will bring the zone to the installed state. A zone doesn't have to be booted into the ready state before it can enter the running state. Issuing
Manage processes
Display zone name with running process ps -e -Z
Display processes running in zone (from global zone) ps -z zone Display zone statistics prstat -Z Kill process by name in zone pkill -z zone process_name Find process by name in zone pgrep -z zone process_name List process tree in zone ptree -z zone
Create resource pool poolcfg -dc 'create pool zone_pool' Associate processor set with pool poolcfg -dc 'associate pool zone_pool (pset two_cpu)' Enable pool facility pooladm -e Save active pool configuration pooladm -s /etc/pooladm.conf Activate the /etc/pooladm.conf configuration pooladm -c
Memory capping
To manage the memory usage of zone's you can use the so-called memory capping feature in Solaris. Setup project projadd -c "Project Description" -G users -p 101 users projmod -s -K rcap.max-rss=1000k users Enable resource capping rcapadm -E Check status rcapstat
Colophon Author Peter van Gemert Name solaris_zones_commands.pdf Location http://www2.petervg.nl/quick_reference Created 16 July 2007 Modified 16 July 2007