Wednesday, May 14, 2008

Solaris Container - Zones

Reference: SystemAdministration Guide: Solaris Containers-Resource Management and Solaris Zones

root@myhost1 # zonecfg -z myhost1-v03
myhost1-v03: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:myhost1-v03> create
zonecfg:myhost1-v03> set zonepath=/export/home/zones/myhost1-v03
zonecfg:myhost1-v03> set autoboot=true
zonecfg:myhost1-v03> add inherit-pkg-dir
zonecfg:myhost1-v03:inherit-pkg-dir> set dir=/opt/zoneshare
zonecfg:myhost1-v03:inherit-pkg-dir> end
zonecfg:myhost1-v03> add net
zonecfg:myhost1-v03:net> set address=10.160.242.40
zonecfg:myhost1-v03:net> set physical=e1000g0
zonecfg:myhost1-v03:net> end
zonecfg:myhost1-v03> add net
zonecfg:myhost1-v03:net> set address=10.188.131.44
zonecfg:myhost1-v03:net> set physical=e1000g2
zonecfg:myhost1-v03:net> end
zonecfg:myhost1-v03> add net
zonecfg:myhost1-v03:net> set address=10.190.131.40
zonecfg:myhost1-v03:net> set physical=e1000g3
zonecfg:myhost1-v03:net> end
zonecfg:myhost1-v03> add attr
zonecfg:myhost1-v03:attr> set name=comment
zonecfg:myhost1-v03:attr> set type=string
zonecfg:myhost1-v03:attr> set value="MY Web Server"
zonecfg:myhost1-v03:attr> end
zonecfg:myhost1-v03> set pool=cwp3-pool
zonecfg:myhost1-v03> add fs
zonecfg:myhost1-v03:fs> set dir=/opt/global
zonecfg:myhost1-v03:fs> set special=/opt/child
zonecfg:myhost1-v03:fs> set type=lofs
zonecfg:myhost1-v03:fs> set options=[rw,nodevices]
zonecfg:myhost1-v03:fs> end
zonecfg:myhost1-v03> verify
zonecfg:myhost1-v03> commit
zonecfg:myhost1-v03> exit
root@myhost1 # zoneadm -z myhost1-v03 verify
WARNING: /export/home/zones/myhost1-v03 does not exist, so it could not be verified.
When 'zoneadm install' is run, 'install' will try to create
/export/home/zones/myhost1-v03, and 'verify' will be tried again,
but the 'verify' may fail if:
the parent directory of /export/home/zones/myhost1-v03 is group- or other-writable
or
/export/home/zones/myhost1-v03 overlaps with any other installed zones.
root@myhost1 # zoneadm -z myhost1-v03 install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <2664> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1067> packages on the zone.
Initializing package <3> of <1067>: percent complete: 0%
Initializing package <7> of <1067>: percent complete: 0%
Initializing package <11> of <1067>: percent complete: 0%
Initializing package <15> of <1067>: percent complete: 1%
Initializing package <18> of <1067>: percent complete: 1%
Initializing package <22> of <1067>: percent complete: 2%
Initializing package <26> of <1067>: percent complete: 2%
Initializing package <30> of <1067>: percent complete: 2%
..
..
Initializing package <1051> of <1067>: percent complete: 98%
Initializing package <1055> of <1067>: percent complete: 98%
Initializing package <1059> of <1067>: percent complete: 99%
Initializing package <1062> of <1067>: percent complete: 99%
Initializing package <1066> of <1067>: percent complete: 99%
Initialized <1067> packages on zone.
Zone is initialized.
Installation of <7> packages was skipped.
Installation of these packages generated warnings:
The file contains a log of the zone installation.
root@myhost1 # zoneadm -z myhost1-v03 verify
root@myhost1 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
1 myhost1-v01 running /export/home/zones/vacwpq02-v01
3 myhost1-v02 running /export/home/zones/myhost1-v02
- myhost1-v03 installed /export/home/zones/myhost1-v03
root@myhost1 # zoneadm -z myhost1-v03 boot
root@myhost1 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
1 myhost1-v01 running /export/home/zones/vacwpq02-v01
3 myhost1-v02 running /export/home/zones/myhost1-v02
4 myhost1-v03 running /export/home/zones/myhost1-v03
root@myhost1 # zlogin -C myhost1-v03
## Configure the new zone setting

From global zone, run
zlogin myhost1-v3

No comments: