Wednesday, May 4, 2011

How to Create Zones and allocate Resources in Solaris 10





root@sqazone01# zonecfg -z zone1
zone3: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/zones/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> add net

Use this command if you want to have your own /usr, /lib, /platform or /sbin
zonecfg:zone1> 
remove inherit-pkg-dir dir=/usr

zonecfg:zone1:net> set address=
zonecfg:zone1:net> set physical=ipge0:01
zonecfg:zone1:net> end
zonecfg:zone1> verify
zonecfg:zone1> exit


root@sqazone01 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
3 zone1 configured /zones/zone1
- my-zone incomplete /export/home/my-zone

root@sqazone01 # zoneadm -z zone1 install ( will take 10 - 15 mins)

root@sqazone01 # zoneadm -z zone1 boot


The following command will ask you couple of questions like local and all...and this command will actually
configure your OS.
root@sqazone01 # zlogin -C zone1


root@sqazone01 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
3 zone1 running /zones/zone1
- my-zone incomplete /export/home/my-zone



How to create resource pools for ZONES configured above:


root@sqazone01 # pgrep -l poold
root@sqazone01 # pooladm
pooladm: couldn't open pools state file: Facility is not active

root@sqazone01 # pooladm -e

root@sqazone01 # pgrep -l poold
1429 poold


root@sqazone01 #
root@sqazone01 # pooladm -x
root@sqazone01 # pooladm -s
root@sqazone01 # poolcfg -f pool-script
and the pool script contains

create pset zone1-pset ( uint pset.min = 2; uint pset.max = 2 )
create pool zone1-pool
associate pool zone1-pool ( pset zone1-pset )

root@sqazone01 # pooladm -c
root@sqazone01 # psrset
user processor set 1: processors 0 1
root@sqazone01 # pooladm

system sqazone01
string system.comment
int system.version 1
boolean system.bind-default true
int system.poold.pid 6862

pool zone1-pool
int pool.sys_id 1
boolean pool.active true
boolean pool.default false
int pool.importance 1
string pool.comment
pset zone1-pset

pool pool_default
int pool.sys_id 0
boolean pool.active true
boolean pool.default true
int pool.importance 1
string pool.comment
pset pset_default

pset zone1-pset
int pset.sys_id 1
boolean pset.default false
uint pset.min 2
uint pset.max 2
string pset.units population
uint pset.load 0
uint pset.size 2
string pset.comment

cpu
int cpu.sys_id 1
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 0
string cpu.comment
string cpu.status on-line

pset pset_default
int pset.sys_id -1
boolean pset.default true
uint pset.min 1
uint pset.max 65536
string pset.units population
uint pset.load 30
uint pset.size 30
string pset.comment

cpu
int cpu.sys_id 21
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 20
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 23
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 22
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 17
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 16
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 19
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 18
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 29
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 28
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 31
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 30
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 25
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 24
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 27
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 26
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 5
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 4
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 7
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 6
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 3
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 2
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 13
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 12
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 15
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 14
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 9
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 8
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 11
string cpu.comment
string cpu.status on-line

cpu
int cpu.sys_id 10
string cpu.comment
string cpu.status on-line
root@sqazone01 # zonecfg -z zone1
zonecfg:zone1> set pool=zone1-pool
zonecfg:zone1> verify
zonecfg:zone1> exit

root@sqazone01 # zlogin zone1 init 6
root@sqazone01 #
root@sqazone01 #
root@sqazone01 # zoneadm list -cv
ID NAME STATUS PATH
0 global running /
3 zone1 running /zones/zone1
- my-zone incomplete /export/home/my-zone
root@sqazone01 # zlogin -C zone1
[Connected to zone 'zone1' console]

sqazone02 console login: root
Password:
Sep 28 06:02:57 sqazone02 login: ROOT LOGIN /dev/console

Last login: Thu Sep 28 03:42:07 on console
Sun Microsystems Inc. SunOS 5.10 Generic January 2005

# psrinfo
0 on-line since 09/27/2006 21:07:16
1 on-line since 09/27/2006 21:07:17
#


HOW TO ALLOCATE MEMORY to zone1 :

root@sqazone01 # zloginc -C zone1
zloginc: not found
root@sqazone01 # zlogin -C zone1
[Connected to zone 'zone1' console]

sqazone02 console login: root
Password:
Sep 28 06:33:36 sqazone02 login: ROOT LOGIN /dev/console
Last login: Thu Sep 28 06:02:57 on console
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
# cp /etc/nsswitch.files /etc/nsswitch.conf
# ps -ef | grep rcapd
root 7565 7521 0 06:34:47 console 0:00 grep rcapd
# rcapadm -E
# ps -ef | grep rcapd
daemon 7573 7086 0 06:34:52 ? 0:00 /usr/lib/rcap/rcapd
root 7574 7521 0 06:34:55 console 0:00 grep rcapd
# projmod -K 'rcap.max-rss=4000000000' system
# cat /etc/project
system:0::::rcap.max-rss=4000000000
user.root:1::::
noproject:2::::
default:3::::
group.staff:10::::
# exit

# rcapadm
state: enabled

memory cap enforcement threshold: 0%
process scan rate (sec): 15
reconfiguration rate (sec): 60
report rate (sec): 5
RSS sampling rate (sec): 5

# rcapadm -c 50
# rcapadm
state: enabled
memory cap enforcement threshold: 50%
process scan rate (sec): 15
reconfiguration rate (sec): 60
report rate (sec): 5
RSS sampling rate (sec): 5
#
# rcapstat -g
id project nproc vm rss cap at avgat pg avgpg
0 system 30 112M 82M 3815M 0K 0K 0K 0K
physical memory utilization: 6% cap enforcement threshold: 50%
0 system 30 112M 82M 3815M 0K 0K 0K 0K
physical memory utilization: 6% cap enforcement threshold: 50%
0 system 30 112M 82M 3815M 0K 0K 0K 0K
physical memory utilization: 6% cap enforcement threshold: 50%

No comments:

Post a Comment