Powered By Blogger

Thursday, January 20, 2011

Creating a Zone in Solaris 10

To view a list and status of currently installed zones:
------------------------------------------------------

# zoneadm list -vi

ID NAME STATUS PATH
0 global running /
1 jumpstart running /u01/zones/jumpstart


To create a new zone:
--------------------

# zonecfg -z
(if the zone has not been configured at all previously, you will receive:

No such zone configured
Use 'create' to begin configuring a new zone.
)
a full example of zone creation for a zone called 'zone1':
---------------------------------------------------------

# zonecfg -z zone1
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/u01/zones/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> add fs
zonecfg:zone1:fs> set dir=/opt
zonecfg:zone1:fs> set special=/opt
zonecfg:zone1:fs> set type=lofs
zonecfg:zone1:fs> add options [ro,nodevices]
zonecfg:zone1:fs> end
zonecfg:zone1> verify
zonecfg:zone1> add net
zonecfg:zone1:net> set address=10.67.1.151/24
zonecfg:zone1:net> set physical=eri0
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> commit
zonecfg:zone1> exit

# zoneadm -z zone1 install
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <1887> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <951> packages on the zone.
Initialized <951> packages on zone.
Zone is initialized.
Installation of <1> packages was skipped.
Installation of these packages generated warnings:
The file contains a log of the zone installation.
# zoneadm -z zone1 boot
# zlogin -e \@ -C zone1 # -e sets the escape sequence for console session
[Connected to zone 'zone1' console]

To Delete a Zone Permanently:
----------------------------

zoneadm -z halt
zoneadm -z uninstall
zonecfg -z delete

To Delete a zone in a weird state:
---------------------------------

If the install get interrupted, or the configuration has problems, the zone can end up in an incomplete
state. In this state, it is difficult to uninstall or delete, or continue the configuration. To remove
the incomplete zone and start fresh, do the following:

1. remove the zone entry in /etc/zones/index:

global:installed:/
zone1:installed:/u01/zones/zone1
zone2:installed:/u01/zones/zone2
zone3:incomplete:/u01/zones/zone3 <-----------

2. delete the xml file associated with the zone under /etc/zones

3. delete the directory associated with the zone (if it has been created)

1 comment: