• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
Solaris Containers (formally zones) cheat sheet

There are two types of zonesglobal andnon-global. The global zone is the server itself and is used as the
system-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 root
zone
Solaris packages are copied to the zone's private file system. Disk space usage is much greater than using a
spare root zone
spare root zone
You 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 theinherit-pkg- dir resource to specify which directories to inherit.
Zone States
Configured
Configuration has been completed and storage has been committed. Additional configuration is
still required.
Incomplete
Zone is in this state when it is being installed or uninstalled.
Installed

The zone has a confirmed configuration,zone adm is used to verify the configuration, Solaris
packages have been installed, even through it has been installed, it still has no virtual platform
associated with it.

Ready (active)

Zone's virtual platform is established. The kernel creates thezsc hed process, the network
interfaces 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 an
operational zone.
Shutting down + Down
(active)
Normal state when a zone is being shutdown.
Zone Daemons
zoneadm
Each zone will have a zoneadm associated with it and carries out the following actions:

allocates the zone ID and starts the zsched process
sets system-wide resource controls
prepares the zone's devices if any specified in the zone configuration
plumbs the virtual network interface
mounts any loopback or conventional filesystems

zsched
The 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 -cv
ID
NAME
STATUS
PATH
0
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 a
alpha-numeric character. It can include underbars(_), hyphens (-) and periods (.). The nameglobal andSUN W
are reserved
words and cannot be used.

# zonecfg -z testzone
testzone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:testzone> create
zonecfg:testzone> set zonepath=/zones/testzone
zonecfg:testzone> set autoboot=true
zonecfg:testzone> info
zonepath: /zones/testzone
autoboot: true
pool:
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
zonecfg:testzone> verify
zonecfg:testzone> commit
zonecfg: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 is
no other testzone.
# zoneadm list -cv
ID NAME
STATUS
PATH
0
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 ip
address.
Install the zone

Copy the necessary files from the global zone and populate the product database for the zone. While the zone is
being installed
the state changes toincompl ete.

# zoneadm \u2013z testzone install
# zoneadm list \u2013cv
ID

NAME
STATUS
PATH
0
global
running
/
1
testzone
incomplete
/zones/testzone
Once the zone is installed the state changes again toinstal led
# zoneadm list \u2013cv
ID
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 and
filesystems mounted.
There is no "ok>" prompt in a zone.

# zoneadm \u2013z testzone ready
# zoneadm list \u2013cv
ID

NAME
STATUS
PATH
0
global
running
/
1
testzone
ready
/zones/testzone
Booting a zone

When you boot a zone the state changes torunning. When booting a zone it automatically readies the state of a
zone so you
do not need to ready a zone beforehand.

# zoneadm \u2013z testzone boot
# zlogin -C testzone
[Connected to zone 'testzone' console]
[NOTICE: Zone booting up]
SunOS Release 5.10 Version Generic 64-bit
Copyright 1983-2005 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
Hostname: ukstsg10
ukstsg10 console login:

# zoneadm list \u2013cv
ID
NAME
STATUS
PATH
0
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 reported here
as per a
normal 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, terminal
type, 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 \u2013z testzone
zonecfg:testzone> add net
zonecfg:testzone:net> set address=192.168.0.12
zonecfg:testzone:net> set physical=hme0
zonecfg:testzone:net> end
zonecfg:testzone> export
create -b

of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...