Wise people learn when they can; fools learn when they must - Arthur Wellesley

Saturday, 27 December 2014

ZONES-5 whole root zone with exclusive Ip & shared ufs



ZONES-5 

WHOLE ROOT ZONE WITH EXCLUSIVE IP & SHARED FILE SYSTEM FROM GLOBAL ZONE

Fine…

The king has selected 4 tenants, and out of four, 3 tenants are accommodated, it’s time to accommodate the family.

Tzone1     PG (bachelor)   Sparse root
Tzone2     PG (bachelor)   Sparse root
Tzone3     PG (bachelor)   Sparse root
Tzone4     With family     Whole root


The Info provided by tzone4 is,

House No                   IP   192.168.234.203
Separate gas pipeline      YES  I want my own (e1000g2)
Fancy item                 YES  CDROM
Guest                      YES  I want shared FS from GZ
Other info                 YES  Yes I want attributes to be added

King was very irritated with this family drama, that they want everything but king was man of words so he agreed for the arrangements,

Let’s see what the family got?


***[plz increase the ram as much as you can in VM settings before creating whole root, so that it will save some time while copying files from GZ to NGZ]

root@sol-test-1:>/#mkdir /export/zones/tzone4
root@sol-test-1:>/#chmod 700 /export/zones/tzone4
root@sol-test-1:>/#zonecfg -z tzone4
tzone4: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:tzone4> create
zonecfg:tzone4> set zonepath=/export/zones/tzone4
zonecfg:tzone4> set ip-type=exclusive
zonecfg:tzone4> add net
zonecfg:tzone4:net> set physical=e1000g2
zonecfg:tzone4:net> end
zonecfg:tzone4> set autoboot=true
zonecfg:tzone4> add device
zonecfg:tzone4:device> set match=/dev/rmt/0
zonecfg:tzone4:device> end
zonecfg:tzone4> add fs
zonecfg:tzone4:fs> set dir=/cdrom
zonecfg:tzone4:fs> set special=/cdrom
zonecfg:tzone4:fs> set type=lofs
zonecfg:tzone4:fs> end
zonecfg:tzone4> verify
zonecfg:tzone4> commit
zonecfg:tzone4> exit


OOOpsss… I forget to make it whole root zone, let’s edit now,

root@sol-test-1:>/#zonecfg -z tzone4
zonecfg:tzone4> remove inherit-pkg-dir dir=/usr
zonecfg:tzone4> remove inherit-pkg-dir dir=/sbin
zonecfg:tzone4> remove inherit-pkg-dir dir=/lib
zonecfg:tzone4> remove inherit-pkg-dir dir=/platform
zonecfg:tzone4> verify
zonecfg:tzone4> commit
zonecfg:tzone4> exit


root@sol-test-1:>/#zoneadm -z tzone4 install
Preparing to install zone <tzone4>.
Creating list of files to copy from the global zone.
Copying <189370> files to the zone.

*** (see the no of files to be copy, it will take some time…have some coffee….Hey I was wrong about coffee…..go take a nap)

Ahhhhh…. Finally its done

Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1466> packages on the zone.
Initialized <1466> packages on zone.
Zone <tzone4> is initialized.
Installation of these packages generated errors: <SUNWcnetr SUNWcsl SUNWcsr SUNWcsu SUNWdefault-java SUNWjdmk-base SUNWcakr SUNWcar SUNWkvm SUNWlucfg SUNWocfd SUNWckr SUNWcsd BRCMbnx BRCMbnxe SUNWos86r SUNWrmodr CADP160 CPQary3 HPFC NCRos86r SUNWlibmsr SUNWgccruntime SUNWTiff SUNWzlib SUNWjpg SUNWfreetype2 SUNWfontconfig-root SUNWlexpt SUNWfontconfig SUNWgnome-base-libs-root SUNWgnome-base-libs-share SUNWlibms SUNWxorg-clientlibs SUNWperl584core SUNWperl584usr SUNWesu

[……………………………..]

contrib SUNWpostgr-devel SUNWpostgr-jdbc SUNWpostgr-p>
The file </export/zones/tzone4/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

root@sol-test-1:>/#cd /export/zones/tzone4/root/etc
root@sol-test-1:>/export/zones/tzone4/root/etc#vi hostname.e1000g2
"hostname.e1000g2" [New file]
192.168.234.203



root@sol-test-1:>/export/zones/tzone4/root/etc# vi hosts
"hosts" [Read only] 5 lines, 61 characters
#
# Internet host table
#
::1             localhost
127.0.0.1       localhost
192.168.234.203 tzone4  loghost            รง

root@sol-test-1:>/# zoneadm -z tzone4 boot

root@sol-test-1:>/# zlogin -C tzone4
[Connected to zone 'tzone4' console]


======================ANSWER ALL THE QUESTIONS===============

tzone4 console login: root
Password:
Dec 23 16:28:28 tzone4 login: ROOT LOGIN /dev/console
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
# bash
bash-3.2# df -kh
Filesystem             size   used  avail capacity  Mounted on
/                       16G   4.5G    11G    29%    /
/cdrom                 7.2G   4.9G   2.3G    69%    /cdrom
/dev                    16G   4.5G    11G    29%    /dev
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                   3.6G   336K   3.6G     1%    /etc/svc/volatile
/usr/lib/libc/libc_hwcap1.so.1
                        16G   4.5G    11G    29%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   3.6G    36K   3.6G     1%    /tmp
swap                   3.6G    16K   3.6G     1%    /var/run
bash-3.2# cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
/proc           -               /proc           proc    -       no      -
ctfs            -       /system/contract        ctfs    -       no      -
objfs           -       /system/object  objfs   -       no      -
sharefs         -       /etc/dfs/sharetab       sharefs -       no      -
fd              -               /dev/fd         fd      -       no      -
swap            -               /tmp            tmpfs   -       yes     -

bash-3.2#


OK…. Now done with whole root zone,

But the family told that they want some more space for guest, In other words it can be said that app team demands a separate 4g FS for some app.

Now what?

It needs to share a FS from GZ,

Let’s do it.

Created a 4g partition on c1t2d0s0

root@sol-test-1:>/# newfs /dev/rdsk/c1t2d0s0
newfs: construct a new file system /dev/rdsk/c1t2d0s0: (y/n)? y

Make a dir under the root of NGZ, who wants the shared FS

root@sol-test-1:>/# mkdir /export/zones/tzone4/root/testdir4WRzone

root@sol-test-1:>/# mount -f ufs /dev/dsk/c1t2d0s0 /export/zones/tzone4/root/testdir4WRzone

root@sol-test-1:>/# zonecfg -z tzone4
zonecfg:tzone4> info
zonename: tzone4
zonepath: /export/zones/tzone4
brand: native
autoboot: true
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: exclusive
hostid:
fs:
        dir: /cdrom
        special: /cdrom
        raw not specified
        type: lofs
        options: []
net:
        address not specified
        physical: e1000g2
        defrouter not specified
device
        match: /dev/rmt/0
zonecfg:tzone4> add fs
zonecfg:tzone4:fs> set dir=/testdir4WRzone
zonecfg:tzone4:fs> set special=/dev/dsk/c1t2d0s0
zonecfg:tzone4:fs> set raw=/dev/rdsk/c1t2d0s0
zonecfg:tzone4:fs> set type=ufs
zonecfg:tzone4:fs> add options [logging,nosuid]
zonecfg:tzone4:fs> end
zonecfg:tzone4> verify
zonecfg:tzone4> commit
zonecfg:tzone4> exit

Now, check this at NGZ tzone4

root@sol-test-1:>/# zlogin -C tzone4
[Connected to zone 'tzone4' console]

bash-3.2# id
uid=0(root) gid=0(root)
bash-3.2# hostname
tzone4
bash-3.2# df -kh
Filesystem             size   used  avail capacity  Mounted on
/                       16G   4.5G    11G    29%    /
/cdrom                 7.2G   4.9G   2.3G    69%    /cdrom
/dev                    16G   4.5G    11G    29%    /dev
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                   3.6G   336K   3.6G     1%    /etc/svc/volatile
/usr/lib/libc/libc_hwcap1.so.1
                        16G   4.5G    11G    29%    /lib/libc.so.1
fd                       0K     0K     0K     0%    /dev/fd
swap                   3.6G    36K   3.6G     1%    /tmp
swap                   3.6G    20K   3.6G     1%    /var/run
/testdir4WRzone        3.9G   4.0M   3.9G     1%    /testdir4WRzone



No comments:

Post a Comment