Total Pageviews

Thursday, 27 March 2014

ZONES (OS level Virtualization) !!!!

With the concept of ZONES (OS level virtualizing) can create multiple instance on existing OS. So that we can manage multiple applications and their environments within one operating system instance.

Let us start with types of zones :

1) Sparse root zone      2) Whole root zone      3) Branded zones

Whole root zone : A wholeroot zone copies all the packages from global zone. 

Sparse root Zone : It maintains an loop back filesystem (LOFS) of all the critical file system from the base OS. It shares the main configuration files from the global zone. /usr, /platform, /sbin, /lib are the file systems are shared from global zone. 

To know the difference between zone, create both whole and sparse root zone, then type the command: 
$zonecfg -z <zonename> info 
  inherit-pkg-dir:

Branded zones : We need to install packages from OS.

For any kind of zone there will be some common states.

1) Uninitialized : initial state of a zone.Not yet started anything.
2) Configured : soon after configuring paramaters, zone will be in configured state.No software has been installed yet. 
3) Incomplete : In this state we can install packages.Zone is ready to be installed or uninstalled.
4) Installed  : Package tools can be run.After installing complete parameters a zone will be in installed state.
5) Ready : Zone is installed and about to move to running state. 
6) Running : Zone will be providing its services.

If a zone is currently in running state to perform any operation like reboot or deletion we need to halt the zone first and then reboot or uninstall.

Let say to delete my existing zone , I need to follow below steps :

zoneadm -z <zone> halt                         ------ halting my zone.
zoneadm -z <zone> uninstall                 ------ uninstall now
zonecfg -z <zone> delete -F                   ------ now we can delete it 

All the administration related tasks will be done by using zoneadm command
and all configuration related tasks will be done by using zonecfg command.

Few regular usage commands :

To view list of zones         zoneadm list -cv
To verify a zone   zoneadm -z <zone> verify
To install a zone                zoneadm -z <zone> install
To make a zone ready   zoneadm -z <zone> ready
To boot a zone     zoneadm -z <zone> boot
To reboot a zone   zoneadm -z <zone> reboot
To halt a zone                   zoneadm -z <zone> halt
To uninstall a zone            zoneadm -z <zone> uninstall -F

zonecfg -z myz
myz: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:myz>
zonecfg:myz> create
zonecfg:myz>
zonecfg:myz> set zonepath=/testz
zonecfg:myz> verify
zonecfg:myz> commit
zonecfg:myz> 
zonecfg:myz>add net
zonecfg:myz:net> set physical=eri0
zonecfg:myz:net> set address=192.168.100.111
zonecfg:myz:net> end
zonecfg:myz>add device
zonecfg:myz:device>set match = /dev/dsk/c1t0d0s5
zonecfg:myz:device>end
zonecfg:myz:fs> end
zonecfg:myz> add inherit-pkg-dir
zonecfg:myz:inherit-pkg-dir> set dir=/opt/csw
zonecfg:myz:inherit-pkg-dir> end
zonecfg:myz> info
 zonepath: /testz
 autoboot: true
 pool:
 inherit-pkg-dir:
         dir: /lib
 inherit-pkg-dir:
         dir: /platform
 inherit-pkg-dir:
         dir: /sbin
 inherit-pkg-dir:
         dir: /usr
 inherit-pkg-dir:
         dir: /opt/csw
 net:
         address: 192.168.100.111
         physical: eri0
 zonecfg:myz> verify
 zonecfg:myz> commit
 zonecfg:myz> exit

################################################################################

No comments:

Post a Comment