Thursday, February 26, 2009

Solaris Zone Basics

# uname -a
SunOS nido 5.10 Generic_118844-26 i86pc i386 i86pc

# pwd
/
create a Zone
# zonecfg -z
nidoz3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:nidoz3> create
zonecfg:nidoz3> set autoboot=true
zonecfg:nidoz3> set zonepath=/nidoz3
zonecfg:nidoz3> add net
zonecfg:nidoz3:net> set address=137.72.420.420/24
zonecfg:nidoz3:net> set physical=e1000g0
zonecfg:nidoz3:net> end
zonecfg:nidoz3> verify
zonecfg:nidoz3> commit
zonecfg:nidoz3> exit
#
# zoneadm list –cv
# cat /etc/zones/nidoz3.xml
# mkdir /nidoz3
# chmod 700 /nidoz3
# zoneadm -z nidoz3
# zoneadm -z nidoz3 install
#zoneadm list –cv

#zoneadm -z nidoz3 boot
#zoneadm list -cv
#zlogin -C nidoz3

Add File-System: Mount FileSystem in Global Zone:
zonecfg:nidoz3> add fs
zonecfg:nidoz3:fs> set dir=/opt
zonecfg:nidoz3:fs> set special=/nidoz4_1/opt
zonecfg:nidoz3:fs> set type=lofs
zonecfg:nidoz3:fs> set options=rw,nodevices
zonecfg:nidoz3:fs> end

Remove a FileSystem in Non-Global Zone
global# zonecfg -z zonename
remove fs dir=/usr/local/mysql/data

To get the Non-Global Zone Information:
# cat /etc/zones/nidoz3.xml
Or
zonecfg:nidoz1> info
Or
# zoneadm list –cv
Or
# zonecfg -z nidoz1 export

To Set the IP Address for Non-Global Zone
ifconfig e1000g0:3 plumb 137.72.420.420 netmask 255.255.255.0 zone nidoz3 up

To Delete a Non-Global Zone:
# zoneadm list –cv
# zoneadm -z nidoz3 halt
# zoneadm list –cv
# zoneadm -z nidoz3 uninstall
# zoneadm list –cv
# zonecfg -z nidoz1 delete
# zoneadm list –cv
-----------------------------------------------------------------------------------------
Refer the Following URL for zone create script: (Not tested yet but will soon be )

No comments:

Post a Comment