/  5
 
Solaris Containers (formally zones) cheat sheet
There are two types of zones
 global 
and
non-global 
. The global zone is the server itself and is used as thesystem-wide configuration and control, there can only be one global zone per system. A maximum of 8192 non-global zones can exist on a system, all non-global zones are isolated from each other.There are two type types of non-global zones
 spare root zone
or 
whole root zones
.
whole rootzoneSolaris packages are copied to the zone's private file system. Disk space usage is much greater than using aspare root zonespare root zoneYou can determine how much of the global zone file system you want to be inherited from the global zone.Spare root zones use loopback file systems from global zone.Use the
inherit-pkg-dir 
resource to specify which directories to inherit.
Zone States
ConfiguredConfiguration has been completed and storage has been committed. Additional configuration isstill required.IncompleteZone is in this state when it is being installed or uninstalled.InstalledThe zone has a confirmed configuration,
zoneadm
is used to verify the configuration, Solarispackages have been installed, even through it has been installed, it still has no virtual platformassociated with it.Ready (active)Zone's virtual platform is established. The kernel creates the
zsched 
process, the networkinterfaces are plumbed and filesystems mounted. The system also assigns a zone ID at this state,but no processes are associated with this zone.Running (active)A zone enters this state when the first user process is created. This is the normal state for anoperational zone.Shutting down + Down(active)Normal state when a zone is being shutdown.
Zone Daemons
zoneadmEach zone will have a zoneadm associated with it and carries out the following actions:allocates the zone ID and starts the zsched processsets system-wide resource controlsprepares the zone's devices if any specified in the zone configurationplumbs the virtual network interfacemounts any loopback or conventional filesystemszschedThe job of the zsched is to keep track of kernel threads running withon the zone.
List zone name
# zonename
List all zones
All the configured zone and there status should be listed.
# zoneadm list -cvID NAME STATUS PATH0 global running /
 
3 testzone running /zones/testzone
Creating a zone
When creating a zone the zonename must be unique, no longer than 64 characters and is case-sensitive and must begin with aalpha-numeric character. It can include underbars(_), hyphens (-) and periods (.). The name
 global 
and
SUNW 
are reservedwords and cannot be used.
# zonecfg -z testzonetestzone: No such zone configuredUse 'create' to begin configuring a new zone.zonecfg:testzone> createzonecfg:testzone> set zonepath=/zones/testzonezonecfg:testzone> set autoboot=truezonecfg:testzone> infozonepath: /zones/testzoneautoboot: truepool:inherit-pkg-dir:dir: /libinherit-pkg-dir:dir: /platforminherit-pkg-dir:dir: /sbininherit-pkg-dir:dir: /usrzonecfg:testzone> verifyzonecfg:testzone> commitzonecfg:testzone> ^D
The zone will now be created in a installed state, ignore the error at the top as this is just reporting that there isno other testzone.
# zoneadm list -cvID NAME STATUS PATH0 global running /- testzone installed /zones/testzone
/zones can be a filesystem or directory. Although the zone has been create it does not have resouces yet i.e no ipaddress.
Install the zone
Copy the necessary files from the global zone and populate the product database for the zone. While the zone is being installedthe state changes to
incomplete.
# zoneadm –z testzone install# zoneadm list –cvID NAME STATUS PATH0 global running /1 testzone incomplete /zones/testzone
Once the zone is installed the state changes again to
installed 
# zoneadm list –cvID NAME STATUS PATH
 
0 global running /1 testzone installed /zones/testzone
Ready a zone
When the zone is in the ready state it is associated with a virtual platform, network interfaces are plumbed andfilesystems mounted.There is no "ok>" prompt in a zone.
# zoneadm –z testzone ready# zoneadm list –cvID NAME STATUS PATH0 global running /1 testzone ready /zones/testzone
Booting a zone
When you boot a zone the state changes to
running 
. When booting a zone it automatically readies the state of azone so youdo not need to ready a zone beforehand.
# zoneadm –z testzone boot# zlogin -C testzone[Connected to zone 'testzone' console][NOTICE: Zone booting up]SunOS Release 5.10 Version Generic 64-bitCopyright 1983-2005 Sun Microsystems, Inc. All rights reserved.Use is subject to license terms.Hostname: ukstsg10ukstsg10 console login:# zoneadm list –cvID NAME STATUS PATH0 global running /4 testzone running /export/home/testzone
Login into a zones console
You can login to the zones console, use '~.' to exit out of the console. All console messages will be reportedhere as per anormal console, they only difference is there is no "ok>" prompt.The first time a zone is booted you have to finish off the configuration which asks you set language, terminaltype, etc
# zlogin -C testzone
Adding a network resource to a zone
You need to log into the zone for the changes to take effect
# zonecfg –z testzonezonecfg:testzone> add netzonecfg:testzone:net> set address=192.168.0.12zonecfg:testzone:net> set physical=hme0zonecfg:testzone:net> endzonecfg:testzone> exportcreate -b

Share & Embed

More from this user

Add a Comment

Characters: ...