Playing with Solaris Zones



Solaris has operating system level virtualization so you can run only solaris in virtual hosts as it uses the same copy of kernel used by parent OS. It is very fast and it is observed that only 1-3% of overhead degradation is caused.
Zones
  There are two types of zones.
1. Global/parent Zones (base OS)
2. Non-global Zones

1. One machine can have 8192 zones
2. Zones  don't have graphics
3. Zones are not installed from DVD or from some installation media these are installed from parent OS.
4. Usually we don't run instances/services on Global zone as if global zone is down all the non-global zones are down as well.

There are two types of non-global zones
1. Whole root Zone
    It contains complete solaris OS. it is slow and usually not recommended in production. In a way it is copy or replica of the whole global zone.
2. Spare root zone
    This type of zone shares some parts of solaris OS from parent zone. These are speedy as whole OS is not loaded only a few parts are loaded from global zone.
3. This type of zones inherit four directories from parent OS.

1. /usr (as it uses all programs of gloabl zone if a program is removed from this type of zone it will remain in global zone.)
2. /lib (as it will use OS libraries of global zone)
3./sbin (super user binaries are also used from global zone.)
4. /platform (platform independent modules are also downloaded from global zone.)


States inwhich a zone can fall


configured – It has the initial configuration. Zone was not installed and it can not be booted.
incomplete – This is the status when zoneadm is installing or unistalling a zone.
installed – Zone is configured and packages are installed. You only need to boot it
ready – The zone is ready. There is a zsched process and all interfaces are plumbed. It will be moved to running status.
Running – It is running!  Everything is ready you can use the zone.
Shutting down and down – When the zone is being halted.


Configuration of a "Spare root Zone"

 Following steps are performed to configure a spare root zone
1. Configure
2. install
3. Boot

Following are some of the commands to administrate a spare root zone

zonename = To check the name of the zone bydefault global zone.
-bash-3.00# zonename
global

zoneadm list = To check the list of the zones on the machine
-bash-3.00# zoneadm list
global
Following is the file which contains information related to zones

-bash-3.00# cat /etc/zones/index

Now we will configure a zone on the machine

1. Create a directory for storing zone

-bash-3.00# cd /
-bash-3.00# pwd
/
-bash-3.00# mkdir solzone
Set its permissions as
-bash-3.00# chmod 700 /solzone

Now create and Configure a zone

-bash-3.00# zonecfg -z solzone
solzone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:solzone>

Tab can be used to check/complete available commands in this console

now create a zone

zonecfg:solzone> create

Now set the zone path to the directory which we created for storing zone

zonecfg:solzone> set zonepath=/solzone/

Now set whether you want to boot this zone on system startup up or not

zonecfg:solzone> set autoboot=true

Now configure the network interface

zonecfg:solzone> add net
set address=   set physical=e1000g1
zonecfg:solzone:net> set address=192.168.56.200
zonecfg:solzone:net> end
zonecfg:solzone> add capped-memory
zonecfg:solzone:capped-memory> set physical=512m
zonecfg:solzone:capped-memory> set swap=512m
zonecfg:solzone:capped-memory> end
zonecfg:solzone>verify
zonecfg:solzone>commit
zonecfg:solzone>exit

Now to install the Zone

-bash-3.00# zoneadm -z solzone install

To check information about the zone
-bash-3.00# zonecfg -z solzone info

Now after installation ready the zone for booting
-bash-3.00# zoneadm -z solzone ready

Now boot the zone

-bash-3.00# zoneadm -z solzone boot

To login to the console

-bash-3.00# zlogin -C solzone
if -C is not used root will login without passwd,

First time it will ask for some configuration and than zone will reboot inorder to changes take effect.

Bydefault root is not allowed to ssh the zones we need to create the standard user inorder to login via ssh as allowing ssh sessions directly for root is depricated.

To un-install the zone use this command
-bash-3.00# zoneadm -z solzone uninstall

To  check zone list
-bash-3.00# zoneadm list -v
To reconfigure zone

-bash-3.00# zonecfg -z solzone

Comments

Popular posts from this blog

Using a Self signed Certificate to Run Apache2 under SSL

IPS (Image Packaging system) in Solaris 10