Tuesday, March 11, 2014

How to create and install spare root zone aka non-global zone (Solaris10)

Will talk about to create and install spare root zone. This document will help you to create and install spare root zone on top of GLOBAL zone aka base OS.

This "Zones" future is not there in solaris8/9 OS , from solaris 10 onward we have this facility.

Some of the general info to use ZONES:

  • The utilization of server hardware
  • Effectively use server hardware
  • Minimize hardware cost
  • Host multiple applications / DBs
  • Power saving
  • Cost reduction
  • Reduce space consuming
  • Effectively use data center space
  • Efficient use of server Rack

Steps to create spare root zone with shard IP-address:

Before create any type of zones , please do some of the important steps like below.

1). Collect ifconfig -a / dladm show-dev output from global
2). Decide zone name which you want to create
3). Create zone directory with absolute path
4). Change default permission to 700 for zone path
5). Decide IP-Address which your going to use for zone

Basically and by default, there are four directories which are sharing from GLOBAL zone to a non-global zone (Spare-Zone) /lib, /platform, /sbin and /usr.

Here I am providing screenshot for creating simple spare root zone.

My GLOBAL zone ifconfig / dladm details.
bash-3.2# ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843 mtu 1500 index 2
        inet 192.168.10.21 netmask ffffff00 broadcast 192.168.10.255
        ether 0:c:29:1d:c0:ff
bash-3.2# dladm show-dev
e1000g0         link: up        speed: 1000  Mbps       duplex: full
e1000g1         link: unknown   speed: 0     Mbps       duplex: half
bash-3.2#
Create directory for zone and change permission:
bash-3.2# mkdir /zonepool/tpt01
bash-3.2# chmod 700 /zonepool/tpt01
bash-3.2# ls -ld /zonepool/tpt01
drwx------   2 root     root           2 Mar 12 00:52 /zonepool/tpt01
bash-3.2#
Start configure zone:
bash-3.2# zonecfg -z tpt01
tpt01: No such zone configured
Use 'create' to begin configuring a new zone.

zonecfg:tpt01> create
zonecfg:tpt01> add net
zonecfg:tpt01:net> set physical=e1000g0
zonecfg:tpt01:net> set address=192.168.10.13
zonecfg:tpt01:net> end
zonecfg:tpt01> set zonepath=/zonepool/tpt01
zonecfg:tpt01> commit
zonecfg:tpt01> verify
zonecfg:tpt01> info
zonename: tpt01
zonepath: /zonepool/tpt01
brand: native
autoboot: false
bootargs: 
pool: 
limitpriv: 
scheduling-class: 
ip-type: shared
hostid: 
inherit-pkg-dir:
dir: /lib
inherit-pkg-dir:
dir: /platform
inherit-pkg-dir:
dir: /sbin
inherit-pkg-dir:
dir: /usr
net:
address: 192.168.10.13
physical: e1000g0
defrouter not specified

zonecfg:tpt01> exit
bash-3.2#
Start installing zone:
bash-3.2# zoneadm -z tpt01 install
A ZFS file system has been created for this zone.
Preparing to install zone .
Creating list of files to copy from the global zone.
Copying <2923> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1466> packages on the zone.
Initializing package <0> of <1466>: percent complete: 0%         
Initializing package <1> of <1466>: percent complete: 0%         
Initializing package <1464> of <1466>: percent complete: 99%         
Initializing package <1465> of <1466>: percent complete: 99%         
Initialized <1466> packages on zone.                                
Zone  is initialized.
The file (/zonepool/tpt01/root/var/sadm/system/logs/install_log) contains a log of the zone installation. 
Check the zones status:
bash-3.2# zoneadm list -cv
  ID NAME       STATUS     PATH                      BRAND    IP    
   0 global     running    /                         native   shared
   - tpt01      installed  /zonepool/tpt01           native   shared
bash-3.2#
Boot the zone:
bash-3.2# zoneadm -z tpt01 boot
Login to the console and provide all the details to complete the installation:
bash-3.2# zlogin -C tpt01
[Connected to zone 'tpt01' console]
 33/157 34/157 35/157 36/157 37/157 38/157 39/157 40/157 41/157 
Select a Language

  0. English
  1. Japanese
  2. Korean
  3. Simplified Chinese
  4. Traditional Chinese

Please make a choice (0 - 4), or press h or ? for help: 0

rebooting system due to change(s) in /etc/default/init

[NOTICE: Zone rebooting]
SunOS Release 5.10 Version Generic_147441-01 64-bit
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
Hostname: tpt01
 tpt01 console login: root
Password: Mar  5 23:08:59 tpt01 sendmail[13000]: My unqualified host name (tpt01) unknown; sleeping for retry Mar  5 23:08:59 tpt01 sendmail[13012]: My unqualified host name (tpt01) unknown; sleeping for retry 
Mar  5 23:09:00 tpt01 login: ROOT LOGIN /dev/console Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
Login to the zone:
bash-3.2# zlogin tpt01
[Connected to zone 'tpt01' pts/4]
Last login: Tue Mar  4 23:47:02 on pts/4
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
#bash
bash-3.2# df -h
Filesystem             size   used  avail capacity  Mounted on
/                       19G   115M    19G     1%    /
/dev                    19G   115M    19G     1%    /dev
/lib                    14G   9.8G   3.9G    72%    /lib
/platform               14G   9.8G   3.9G    72%    /platform
/sbin                   14G   9.8G   3.9G    72%    /sbin
/usr                    14G   9.8G   3.9G    72%    /usr
proc                     0K     0K     0K     0%    /proc
ctfs                     0K     0K     0K     0%    /system/contract
mnttab                   0K     0K     0K     0%    /etc/mnttab
objfs                    0K     0K     0K     0%    /system/object
swap                   571M   312K   570M     1%    /etc/svc/volatile
/usr/lib/libc/libc_hwcap1.so.1
                        14G   9.8G   3.9G    72%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   570M    36K   570M     1%    /tmp
swap                   570M    16K   570M     1%    /var/run
bash-3.2#
Thanks for reading this Article...

0 comments:

Post a Comment