solaris zones poolcfg
TRANSCRIPT
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 1/36
10thMarch2010Archives
09.0410.0411.0412.0401.0502.0503.0504.0505.0506.0507.0508.0509.0510.0511.0512.0501.0602.0603.0604.0605.06
06.0607.0608.0609.0610.0611.0612.0601.0702.0703.0704.0705.0706.0708.0709.0710.0711.0712.0701.0802.0803.08
04.0805.0806.0807.0808.0809.0810.0811.0812.0801.0902.0903.0904.0905.0906.0907.0908.0909.0910.0911.0912.09
01.10
Tuesday,February28,2006
SolarisZones:ResourceControlsCPU
AnoverviewofSolarisZonesisavailableinblogentry:Zonecreationfordummies.Itispossibletolimitthe
resource utilization in each zone,withSolaris containers.Detailed information about the kind of resourcesthatcan
becontrolled,canbe found in theResourceControlschapterofSolarisContainersResourceManagementand
SolarisZonesguide.Theprimaryfocusofthisblogentryistoshowhowtorestrictoneofthezonestousea
maximumof3CPUs,ona4CPUSunserver.
Let'sassumethatwehaveaserverconfiguredtorun3zones(1global+2local),asshownbelow:
%zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
19v1280appservrunning/zones/z1
22v1280webservrunning/zones/z2
Theassumptionisthattheapplicationserverrunninginv1280appservzoneisgoingtoconsumemajorityofCPU
SolarisZones
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 2/36
cycles.Sotogiveafairchancetorunwebserver,andotherapplicationsonthisserver,let'strytorestrictthenonglobal
zone,v1280appserv,touseamaximumof3processorsonly,leavingoneprocessorforthewebserver.This
wasshowninthefollowingfigure:
StepsforCPUresourcecontrol
1.Enablepoolsfacility
Mandalika's
scratchpad
[SCJPmocktest(s)Vocabulary
test]
OpenSolarisEnthusiast
ReportAbuseNextBlogCreateBlogSignIn
Makesuretheresourcepooldaemon,poold,isrunning.
%pseafgreppoold
root2001918948015:03:58pts/30:00greppoold
%pooladm
pooladm:couldn'topenpoolsstatefile:Facilityisnotactive
Useeoptionofpooladmtoenablethepoolsfacility
%pooladme
%pgreppoold
18951
Withoutanyoptions,pooladmprintsoutthecurrentlyrunningpoolsconfiguration
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 3/36
%pooladm
systemsdcv1280s001
stringsystem.comment
intsystem.version1
booleansystem.binddefaulttrue
intsystem.poold.pid18951
poolpool_default
intpool.sys_id0
booleanpool.activetrue
booleanpool.defaulttrue
intpool.importance1
stringpool.comment
psetpset_default
psetpset_default
intpset.sys_id1
booleanpset.defaulttrue
uintpset.min1
uintpset.max65536
stringpset.unitspopulation
uintpset.load17
uintpset.size4
stringpset.comment
cpu
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 4/36
intcpu.sys_id1
stringcpu.comment
stringcpu.statusonline
cpu
intcpu.sys_id0
stringcpu.comment
stringcpu.statusonline
cpu
intcpu.sys_id3
stringcpu.comment
stringcpu.statusonline
cpu
intcpu.sys_id2
stringcpu.comment
stringcpu.statusonline
2.Configure&loadpoolintomemory
Sincetheplanistorestrictv1280appservzoneto3processors,createaninputfileasshownbelow.Thisfilewillbe
usedtoconfiguretherequiredresourcepoolusingpoolcfg.
%catzonepoolcfg
createpsetappservpset(uintpset.min=3uintpset.max=3)
createpoolappservpool
associatepoolappservpool(psetappservpset)
createpsetappservpset(uintpset.min=3uintpset.max=3)createsaprocessorsetwith3
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 5/36
processors
createpoolappservpoolcreatesanewpoolcalledappservpool
associatepoolappservpool(psetappservpset)associatestheprocessorsetappservpsetwithpool
appservpool
Updatetheconfigurationusingthezonepoolcfginputfile.
%poolcfgfzonepoolcfg
poolcfg:cannotloadconfigurationfrom/etc/pooladm.conf:Nosuchfileordirectory
Notethat/etc/pooladm.conffilemustexistbeforeupdatingit.Usesoptionofpooladmtosaveactive
configurationfrommemoryinto/etc/pooladm.conf
%pooladms
%lsl/etc/pooladm.conf
rwrwr1rootroot1429Feb2813:43/etc/pooladm.conf
Nowsince the /etc/pooladm.confexists,update itwith thenewpoolconfiguration thatwe justcreated.Thiscan
bedonewithfoptionofpoolcfgittakestheinputfileasanargument.
%poolcfgfzonepoolcfg
Alternativelyyoucanrunthefollowingcommandsinsteadofaninputfile,toupdatetheconfiguration:
%poolcfgc'createpsetappservpset(uintpset.min=3uintpset.max=3)'
%poolcfgc'createpoolappservpool'
%poolcfgc'associatepoolappservpool(psetappservpset)'
Nextstepistoinstantiate(ie.,activate)theconfigurationfrom/etc/pooladm.confintomemoryusecoption
ofpooladmtodothis.Ittakesafilenameasanargumentbutifnofilenameisspecified,itwillreadthe
configurationfrom/etc/pooladm.conf
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 6/36
%pooladmc
%psrset
userprocessorset1:processors012
Observethatoneprocessorsetiscreatedwith3processorsinthatset.
Checkthecurrentpoolconfigurationonemoretime,withpooladm.
%pooladm
systemsdcv1280s001
stringsystem.comment
intsystem.version1
booleansystem.binddefaulttrue
intsystem.poold.pid18951
poolappservpool
intpool.sys_id1
booleanpool.activetrue
booleanpool.defaultfalse
intpool.importance1
stringpool.comment
psetappservpset
...
...
psetappservpset
intpset.sys_id1
booleanpset.defaultfalse
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 7/36
uintpset.min3
uintpset.max3
stringpset.unitspopulation
uintpset.load0
uintpset.size3
stringpset.comment
cpu
intcpu.sys_id1
stringcpu.comment
stringcpu.statusonline
cpu
intcpu.sys_id0
stringcpu.comment
stringcpu.statusonline
cpu
intcpu.sys_id2
stringcpu.comment
stringcpu.statusonline
...
...
3.Configurethezone(s)
Sincethev1280appservzone isalreadycreated,we justneedtoconnect thezoneto thepool thatwe justcreated.
Usezonecfgtoupdatethezoneconfiguration.
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 8/36
%zonecfgzv1280appserv
zonecfg:v1280appserv>setpool=appservpool
zonecfg:v1280appserv>verify
zonecfg:v1280appserv>exit
Ifthezoneisnotcreatedyet,followtheinstructionsofZonecreationfordummies,andspecifythepool,whenthe
zoneisconfigured.
4.Rebootthezone
Simplyrebootthezone,v1280appserv,soitbindstothenewlycreatedpool,whenitcomesback.
%zloginv1280appservinit6
%zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
19v1280appservshutting_down/zones/z1
22v1280webservrunning/zones/z2
%zoneadmlistcv
IDNAMESTATUSPATH
...
23v1280appservready/zones/z1
%zoneadmlistcv
IDNAMESTATUSPATH
...
23v1280appservrunning/zones/z1
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 9/36
5.Connect&verifytheresourceutilization
v1280appservzone:
v1280appserv:/%psrset
userprocessorset1:processors012
v1280appserv:/%psrinfo
0onlinesince01/19/200613:44:11
1onlinesince01/19/200613:44:12
2onlinesince01/19/200613:44:12
v1280appserv:/%vmstat2
kthrmemorypagediskfaultscpu
rbwswapfreeremfpipofrdesrs0s1s3insycsussyid
000169644806000376368540010003422932404196
000159992725119352025400000200875294896862236
000159944485114792231050000013200620166643351148
00015982504510268033182000000600702224676749250
000159761045096336014000000000575137646132167
00015969896509015208000000000472106756918182
000159632965083672038000000000685244073138260
v1280webservzone:
v1280webserv:/%psrset
v1280webserv:/%psrinfo
3onlinesince01/19/200613:44:12
v1280webserv:/%vmstat2
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 10/36
kthrmemorypagediskfaultscpu
rbwswapfreeremfpipofrdesrs0s1s3insycsussyid
00016964480600037612400001000221101024195
000160329765152368021800000100991013123913483
000160245605143968010000002006991581612385
00016022272514174401000000200417387157290
000160112165130992070000003009293697611485
00016004560512448004000000300447687266292
000159992725119352010000002001321196138719476
GlobalZone:
PIDUSERNAMESIZERSSSTATEPRINICETIMECPUPROCESS/NLWP
19844giri1007M908Mcpu25900:04:4916%siebmtshmw/154
19859giri1007M908Msleep5900:04:4816%siebmtshmw/141
19870giri999M900Mcpu05900:04:3816%siebmtshmw/145
19906giri291M127Mrun29100:01:274.3%webservd/417
19907giri249M85Mrun5900:00:221.2%webservd/158
19976giri103M63Msleep3200:00:011.1%siebmtshmw/7
ZONEIDNPROCSIZERSSMEMORYTIMECPUZONE
23544382M3626M45%0:15:5950%v1280appserv
2240771M320M4.0%0:05:405.5%v1280webserv
037355M80M1.0%1:02:450.2%global
Itisthatsimple.
Troubleshooting:
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 11/36
Ifyouencounterthefollowingerror,doublecheckyourconfiguration.
pooladm:configurationat'/etc/pooladm.conf'cannotbeinstantiatedoncurrentsystem
It is very likely that you configured some resource that is either not available or beyond its limits, on thesystem.
Formoreexamples,see:
1.[URLupdated05/28/08]BrendanGregg'sZonesdocumentation
2.Sun'sHOWTOGuide:SolarisContainers:ConsolidatingServersandApplications
Technoratitags
SolarisOpenSolarisZonesContainers
Postedby:GiriMandalika.#9:27PM1comments.Linkstothispost.
Friday,February17,2006
Solaris10:Zonecreationfordummies
AboutZones
In itssimple form,azone isavirtualoperatingsystemenvironmentcreatedwithinasingle instanceof theSolaris
operatingsystem.Efficientresourceutilizationisthemaingoalofthistechnology.
Solaris10'szonepartitioningtechnologycanbeusedtocreatelocalzonesthatbehavelikevirtualservers.Alllocal
zonesarecontrolledfromthesystem'sglobalzone.Processesrunninginazonearecompletelyisolatedfromtherest
of thesystem.This isolationpreventsprocesses thatare running inonezone frommonitoringoraffectingprocesses
thatare running inotherzones.Note thatprocesses running ina localzonecanbemonitored fromglobalzonebut
theprocessesrunninginaglobalzoneoreveninanotherlocalzonecannotbemonitoredfromalocalzone.
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 12/36
Asofnow,theupperlimitforthenumberofzonesthatcanbecreated/runonasystemis8192ofcourse,depending
ontheresourceavailability,asinglesystemmayormaynotrunalltheconfiguredzoneseffectively.
GlobalZone
Whenwe installSolaris10,aglobal zonegets installedautomaticallyand thecoreoperatingsystem runsunder
globalzone.Tolistalltheconfiguredzones,wecanusezoneadmcommand:
%zoneadmlistv
IDNAMESTATUSPATH
0globalrunning/
Globalzoneistheonlyone:
bootablefromthesystemhardware
tobeusedforsystemwideadministrativecontrol,suchasphysicaldevices,routing,ordynamic
reconfiguration(DR).ie.,globalzoneistheonlyzonethatisawareofalldevicesandallfilesystems
fromwhichanonglobalzonecanbeconfigured,installed,managed,oruninstalled.ie.,globalzoneisthe
onlyzonethatisawareoftheexistenceofnonglobal(local)zonesandtheirconfigurations.Itisnotpossible
tocreatelocalzones,withinalocalzone
StepstocreateaLocalZone
Prerequisites:
Plentyofdiskspacetoholdthenewlyinstalledzone.Itneedsatleast2Gspacetocopytheessentialfilesto
the local zone, andof course thedisk spaceneededby theapplication(s) youareplanning to run, in thiszone
and
AdedicatedIP,fornetworkconnectivity
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 13/36
BasicZonecreationsteps,withexamples:
1.Checkthediskspace&networkconfiguration
%dfh/
FilesystemsizeusedavailcapacityMountedon
/dev/dsk/c1t1d0s029G22G7.1G76%/
%ifconfiga
lo0:flags=2001000849mtu8232index1
inet127.0.0.1netmaskff000000
eri0:flags=1000843mtu1500index2
inet192.168.74.217netmaskfffffe00broadcast192.168.75.255
2.Sincethereismorethan5Gfreespace,I'vedecidedtoinstallalocalzoneunder/zones.
%mkdir/zones
3.Nextstep is todefine/createthezoneroot.This is thepathtozone'srootdirectory that isrelativeto theglobal
zone'srootdirectory.Zonerootmustbeownedbyrootuserwiththemode700.Thiswillbeusedinsetting
thezonepathproperty,duringthezonecreationprocess
%cd/zones
%mkdirappserver
%chmod700appserver
%lsl
total2
drwx2rootroot512Feb1712:46appserver
4.Create&configureanew'sparseroot'localzone,withrootprivileges
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 14/36
%zonecfgzappserv
appserv:Nosuchzoneconfigured
Use'create'tobeginconfiguringanewzone.
zonecfg:appserv>create
zonecfg:appserv>setzonepath=/zones/appserver
zonecfg:appserv>setautoboot=true
zonecfg:appserv>addnet
zonecfg:appserv:net>setphysical=eri0
zonecfg:appserv:net>setaddress=192.168.175.126
zonecfg:appserv:net>end
zonecfg:appserv>addfs
zonecfg:appserv:fs>setdir=/repo2
zonecfg:appserv:fs>setspecial=/dev/dsk/c2t40d1s6
zonecfg:appserv:fs>setraw=/dev/rdsk/c2t40d1s6
zonecfg:appserv:fs>settype=ufs
zonecfg:appserv:fs>setoptionsnoforcedirectio
zonecfg:appserv:fs>end
zonecfg:appserv>addinheritpkgdir
zonecfg:appserv:inheritpkgdir>setdir=/opt/csw
zonecfg:appserv:inheritpkgdir>end
zonecfg:appserv>info
zonepath:/zones/appserver
autoboot:true
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 15/36
pool:
inheritpkgdir:
dir:/lib
inheritpkgdir:
dir:/platform
inheritpkgdir:
dir:/sbin
inheritpkgdir:
dir:/usr
inheritpkgdir:
dir:/opt/csw
net:
address:192.168.175.126
physical:eri0
zonecfg:appserv>verify
zonecfg:appserv>commit
zonecfg:appserv>exit
SparseRootZoneVsWholeRootZone(Updated05/07/2008)
InaSparseRootZone,thedirectories/usr,/sbin,/liband/platformwillbemountedasloopbackfile
systems.Thatis,althoughallthosedirectoriesappearasnormaldirectoriesunderthesparserootzone,they
willbemountedasreadonlyfilesystems.Anychangetothosedirectoriesintheglobalzonecanbeseen
fromthesparserootzone.
Howeverifyouneedtheabilitytowriteintoanyofthosedirectorieslistedabove,youmayneedtoconfigure
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 16/36
aWholeRootZone.Forexample,softwareslikeClearCaseneedwritepermissionsto/usrdirectory.Inthat
caseconfiguringaWholeRootZoneisthewaytogo.Thestepsforcreatingandconfiguringanew'Whole
Root'localzoneareasfollows:
%zonecfgzappserv
appserv:Nosuchzoneconfigured
Use'create'tobeginconfiguringanewzone.
zonecfg:appserv>create
zonecfg:appserv>setzonepath=/zones/appserver
zonecfg:appserv>setautoboot=true
zonecfg:appserv>addnet
zonecfg:appserv:net>setphysical=eri0
zonecfg:appserv:net>setaddress=192.168.175.126
zonecfg:appserv:net>end
zonecfg:appserv>addinheritpkgdir
zonecfg:appserv:inheritpkgdir>setdir=/opt/csw
zonecfg:appserv:inheritpkgdir>end
zonecfg:appserv>removeinheritpkgdirdir=/usr
zonecfg:appserv>removeinheritpkgdirdir=/sbin
zonecfg:appserv>removeinheritpkgdirdir=/lib
zonecfg:appserv>removeinheritpkgdirdir=/platform
zonecfg:appserv>info
zonepath:/zones/appserver
autoboot:true
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 17/36
pool:
inheritpkgdir:
dir:/opt/csw
net:
address:192.168.175.126
physical:eri0
zonecfg:appserv>verify
zonecfg:appserv>commit
zonecfg:appserv>exit
BriefexplanationofthepropertiesthatIadded:
zonepath=/zones/appserver
Localzone'srootdirectory,relativetoglobalzone'srootdirectory.ie.,localzonewillhaveallthebin,lib,
usr,dev,net,etc,var,optetc.,directoriesphysicallyunder/zones/appserverdirectory
autoboot=true
bootthiszoneautomaticallywhentheglobalzoneisbooted
physical=eri0
eri0cardisusedforthephysicalinterface
address=192.168.175.126
192.168.175.126istheIPaddress.ItmusthaveallnecessaryDNSentries
[Added08/25/08]Thewholeaddfssectionaddsthefilesystemtothezone.Inthisexample,thefilesystem
thatisbeingexportedtothezoneisanexistingUFSfilesystem.
setdir=/repo2
/repo2isthemountpointinthelocalzone
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 18/36
setspecial=/dev/dsk/c2t40d1s6
setraw=/dev/rdsk/c2t40d1s6
Grantaccesstotheblock(/dev/dsk/c2t40d1s6)andraw(/dev/rdsk/c2t40d1s6)devicessothefile
systemcanbemountedinthenonglobalzone.Makesuretheblockdeviceisnotmountedanywhereright
beforeinstallingthenonglobalzone.Otherwise,thezoneinstallationmayfailwithERROR:filesystem
checkoffailed:exitstatus:runfsck
manually.Inthatcase,unmountthefilesystemthatisbeingexported,uninstallthepartiallyinstalledzone
(zoneadmzuninstall)theninstallthezonefromthescratch(noneedtoreconfigurethezone,
justdoareinstall).
settype=ufs
ThefilesystemisoftypeUFS
setoptionsnoforcedirectio
Mountthefilesystemwiththeoptionnoforcedirectio[/Added08/25/08]
dir=/opt/csw
readonlypath,willbelofs'd(loopbackmounted)fromglobalzone.Note:itworksforsparserootzoneonly
wholerootzonecannothaveanysharedfilesystems
zonecfgcommandsverifyandcommit,verifiesandcommitsthezoneconfigurationforthezone,
respectively.Notethatitisnotnecessarytocommitthezoneconfigurationitwillbedoneautomatically
whenweexitfromzonecfgtool.infodisplaysinformationaboutthecurrentconfiguration
5.Checkthestateofthenewlycreated/configuredzone
%zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 19/36
appservconfigured/zones/appserver
6.Nextstepistoinstalltheconfiguredzone.Ittakesawhiletoinstallthenecessarypackages
%zoneadmzappservinstall
/zonesmustnotbegroupwritable.
couldnotverifyzonepath/zones/appserverbecauseoftheaboveerrors.
zoneadm:zoneappservfailedtoverify
%lsld/zones
drwxrwxrx3rootroot512Feb1712:46/zones
Since/zonesmustnotbegroupwritable,let'schangethemodeto700.
%chmod700/zones
%lsld/zones
drwx3rootroot512Feb1712:46/zones
%zoneadmzappservinstall
Preparingtoinstallzone.
Creatinglistoffilestocopyfromtheglobalzone.
Copyingfilestothezone.
Initializingzoneproductregistry.
Determiningzonepackageinitializationorder.
Preparingtoinitializepackagesonthezone.
Initializedpackagesonzone.
Zoneisinitialized.
Installationofthesepackagesgeneratederrors:
Installationofpackageswasskipped.
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 20/36
Installationofthesepackagesgeneratedwarnings:
CSWreadlineCSWlibnetCSWlibpcapCSWjpegCSWzlibCSWcommonCSWpkggetSMCethrCSWxpm
SMClsofSMClibgccSMCossldOpenSSHSMCtarSUNWj3dmxCSWexpatCSWftype2CSWfconfig
CSWiconvCSWggettextCSWlibatkCSWpangoCSWpngCSWtiffCSWgtk2CSWpcreCSWlibmm
CSWgsedCSWlibtoolCSWncursesCSWunixodbcCSWoldapCSWt1libCSWlibxml2CSWbzip2
CSWlibidnCSWphp>
Thefilecontainsalogofthezoneinstallation.
7.Verifythestateoftheappservzone,onemoretime
%zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
appservinstalled/zones/appserver
8.Bootuptheappservzone.Let'snotedowntheifconfigoutputtoseehowitchangesafterthelocalzoneboots
up.Alsoobservethatthereisnoanswerfromtheserveryet,sinceitisnotup
%ping192.168.175.126
noanswerfrom192.168.175.126
%ifconfiga
lo0:flags=2001000849mtu8232index1
inet127.0.0.1netmaskff000000
eri0:flags=1000843mtu1500index2
inet192.168.74.217netmaskfffffe00broadcast192.168.75.255
ether0:3:ba:2d:0:84
%zoneadmzappservboot
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 21/36
zoneadm:zone'appserv':WARNING:eri0:1:nomatchingsubnetfoundinnetmasks(4)for192.168.175.126
usingdefaultof255.255.0.0.
%zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
1appservrunning/zones/appserver
%ping192.168.175.126
192.168.175.126isalive
%ifconfiga
lo0:flags=2001000849mtu8232index1
inet127.0.0.1netmaskff000000
lo0:1:flags=2001000849mtu8232index1
zoneappserv
inet127.0.0.1netmaskff000000
eri0:flags=1000843mtu1500index2
inet192.168.74.217netmaskfffffe00broadcast192.168.75.255
ether0:3:ba:2d:0:84
eri0:1:flags=1000843mtu1500index2
zoneappserv
inet192.168.175.126netmaskffff0000broadcast192.168.255.255
Observethatthezoneappservhasit'sownvirtualinstanceoflo0,thesystem'sloopbackinterfaceandthe
zone'sIPaddressisalsobeingservedbytheeri0networkinterface
9.LogintotheZone{console}andperformingtheinternalzoneconfiguration.zloginutilitycanbeusedto
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 22/36
enterazone.Thefirsttimewelogintotheconsole,wegetachancetoansweraseriesofquestionsforthe
desiredzoneconfiguraton.CoptionofzlogincanbeusedtologintotheZoneconsole.
%zloginCe[appserv
[Connectedtozone'appserv'console]
SelectaLanguage
0.English
1.es
2.fr
Pleasemakeachoice(02),orpresshor?forhelp:0
SelectaLocale
0.English(C7bitASCII)
1.Canada(English)(UTF8)
2.CanadaEnglish(ISO88591)
3.U.S.A.(UTF8)
4.U.S.A.(en_US.ISO88591)
5.U.S.A.(en_US.ISO885915)
6.GoBacktoPreviousScreen
Pleasemakeachoice(06),orpresshor?forhelp:0
...
Enterthehostnamewhichidentifiesthissystemonthenetwork.Thename
mustbeuniquewithinyourdomaincreatingaduplicatehostnamewillcause
problemsonthenetworkafteryouinstallSolaris.
Ahostnamemusthaveatleastonecharacteritcancontainletters,
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 23/36
digits,andminussigns().
Hostnameforeri0:1appservv440appserv
...
...
Systemidentificationiscompleted.
...
rebootingsystemduetochange(s)in/etc/default/init
[NOTICE:Zonerebooting]
SunOSRelease5.11Versionsnv_2364bit
Copyright19832005SunMicrosystems,Inc.Allrightsreserved.
Useissubjecttolicenseterms.
Hostname:v440appserv
v440appservconsolelogin:root
Password:
Feb1715:15:30v440appservlogin:ROOTLOGIN/dev/console
SunMicrosystemsInc.SunOS5.11snv_23October2007
%
That is all there is in the creation of a local zone. Now simply login to the newly created zone, just likeconnecting
toanyothersysteminthenetwork.
[New08/27/2008]Mountingfilesystemsinanonglobalzone
Sometimesitmightbenecessarytoexportfilesystemsorcreatenewfilesystemswhenthezoneisalreadyrunning.
Thissection'sfocusisonexportingblockdevicesandtherawdevicesinsuchsituationsi.e.,whenthelocal
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 24/36
zoneis
alreadyconfigured.
ExportingtheRawDevice(s)toanonglobalzone
If thefilesystemdoesnotexistonthedevice,rawdevicescanbeexportedastheyare,sothefilesystemcanbe
createdinsidethenonglobalzoneusingthenormalnewfscommand.
Thefollowingexampleshowshowtoexporttherawdevicetoanonglobalzonewhenthezoneisalready
configured.
#zonecfgzappserv
zonecfg:appserv>adddevice
zonecfg:appserv:device>setmatch=/dev/rdsk/c5t0d0s6
zonecfg:appserv:device>end
zonecfg:appserv>verify
zonecfg:appserv>commit
zonecfg:appserv>exit
Inthisexample/dev/rdsk/c5t0d0s6isbeingexported.
Afterthezonecfgstep,rebootthenonglobalzonetomaketherawdevicevisibleinsidethenonglobalzone.After
thereboot,checktheexistenceoftherawdevice.
#hostname
v440appserv
#lsl/dev/rdsk/c5t0d0s6
crwr1rootsys118,126Aug2714:33/dev/rdsk/c5t0d0s6
Nowthattherawdeviceisaccessiblewithinthenonglobalzone,wecanusetheregularSolariscommandstocreate
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 25/36
anyfilesystemlikeUFS.
eg.,
#newfsvc5t0d0s6
newfs:constructanewfilesystem/dev/rdsk/c5t0d0s6:(y/n)?y
mkfsFufs/dev/rdsk/c5t0d0s61140260864118192102425111208192t018128n
Warning:4096sector(s)inlastcylinderunallocated
/dev/rdsk/c5t0d0s6:1140260864sectorsin185590cylindersof48tracks,128sectors
556768.0MBin11600cylgroups(16c/g,48.00MB/g,5824i/g)
superblockbackups(forfsckFufsob=#)at:
32,98464,196896,295328,393760,492192,590624,689056,787488,885920,
Initializingcylindergroups:
...............................................................................
...............................................................................
.........................................................................
superblockbackupsforlast10cylindergroupsat:
1139344160,1139442592,1139541024,1139639456,1139737888,1139836320,
1139934752,1140033184,1140131616,1140230048
ExportingtheBlockDevice(s)toanonglobalzone
Ifthefilesystemexistsonthedevice,blockdevicescanbeexportedastheyare,sothefilesystemcanbemounted
insidethenonglobalzoneusingthenormalSolariscommand,mount.
Thefollowingexampleshowshowtoexporttheblockdevicetoanonglobalzonewhenthezoneisalready
configured.
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 26/36
#zonecfgzappserv
zonecfg:appserv>adddevice
zonecfg:appserv:device>setmatch=/dev/dsk/c5t0d0s6
zonecfg:appserv:device>end
zonecfg:appserv>verify
zonecfg:appserv>commit
zonecfg:appserv>exit
Inthisexample/dev/dsk/c5t0d0s6isbeingexported.
After the zonecfg step, reboot the nonglobal zone tomake the block device visible inside the nonglobalzone.After
thereboot,checktheexistenceoftheblockdeviceandmountthefilesystemwithinthenonglobalzone.
#hostname
v440appserv
#lsl/dev/dsk/c5t0d0s6
brwr1rootsys118,126Aug2714:40/dev/dsk/c5t0d0s6
#fstyp/dev/dsk/c5t0d0s6
ufs
#mount/dev/dsk/c5t0d0s6/mnt
#dfh/mnt
FilesystemsizeusedavailcapacityMountedon
/dev/dsk/c5t0d0s6535G64M530G1%/mnt
Mountingafilesystemfromtheglobalzoneintothenonglobalzone
Sometimesitisdesirabletohavetheflexibilityofmountingafilesystemintheglobalzoneornonglobalzoneondemand.
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 27/36
Insuchsituations,ratherthanexportingthefilesystemsorblockdevicesintothenonglobalzone,create
thefilesystemintheglobalzoneandmountthefilesystemdirectlyfromtheglobalzoneintothenonglobalzone.
Makesuretounmountthatfilesystemintheglobalzoneifmounted,beforeattemptingtomountitinthenonglobal
zone.
eg.,
Inthenonglobalzone:
#mkdir/repo1
Intheglobalzone:
#dfh/repo1
/dev/dsk/c2t40d0s6134G64M133G1%/repo1
#umount/repo1
#lsld/zones/appserv/root/repo1
drwxrxrx2rootroot512Aug2714:45/zones/appserv/root/repo1
#mount/dev/dsk/c2t40d0s6/zones/appserv/root/repo1
Nowgobacktothenonglobalzoneandcheckthemountedfilesystems.
#hostname
v440appserv
#dfh/repo1
FilesystemsizeusedavailcapacityMountedon
/repo1134G64M133G1%/repo1
Tounmountthefilesystemfromthenonglobalzone,runthefollowingcommandfromtheglobalzone.
#umount/zones/appserv/root/repo1
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 28/36
Removingthefilesystemfromthenonglobalzone
eg.,
Earlier in the zone creation step, the block device /dev/dsk/c2t40d1s6 was exported andmounted on themount
point/repo2insidethenonglobalzone.Toremovethefilesystemcompletelyfromthenonglobalzone,runthe
followingintheglobalzone.
#zonecfgzappserv
zonecfg:appserv>removefsdir=/repo2
zonecfg:appserv>verify
zonecfg:appserv>commit
zonecfg:appserv>exit
Rebootthenonglobalzoneforthissettingtotakeeffect.
[New:08/27/2008]
Shuttingdownandbootingupthelocalzones(Updated01/15/2008)
1.Tobringdownthelocalzone:
%zloginappservshutdowni0
2.Tobootupthelocalzone:
%zoneadmzappservboot
Justforthesakeofcompleteness,thefollowingstepsshowhowtoremovealocalzone.
StepstodeleteaLocalZone
1.Shutdownthelocalzone
%zoneadmzappservhalt
%zoneadmlistcv
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 29/36
IDNAMESTATUSPATH
0globalrunning/
appservinstalled/zones/appserver
2.Uninstallthelocalzoneremovetherootfilesystem
%zoneadmzappservuninstall
Areyousureyouwanttouninstallzoneappserv(y/[n])?y
zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
appservconfigured/zones/appserver
3.Deletetheconfiguredlocalzone
%zonecfgzappservdelete
Areyousureyouwanttodeletezoneappserv(y/[n])?y
zoneadmlistcv
IDNAMESTATUSPATH
0globalrunning/
[New:07/14/2009]
CloningaNonGlobalZone
Thefollowinginstructionsareforcloninganonglobalzoneonthesamesystem.Theexampleshownbelowclones
thesiebeldbzone.After the cloningprocess, abrandnewzoneoraclebi emergesasa replicaof siebeldbzone.
eg.,
#zoneadmlistcv
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 30/36
IDNAMESTATUSPATHBRANDIP
0globalrunning/nativeshared
siebeldbinstalled/zones/dbservernativeexcl
1.Exporttheconfigurationofthezonethatyouwanttoclone/copy
#zonecfgzsiebeldbexport>/tmp/siebeldb.config.cfg
2.Changetheconfigurationofthenewzonethatdifferfromtheexistingoneforexample,IPaddress,dataset
names,networkinterfaceetc.Tomakethesechanges,edit/tmp/siebeldb.config.cfg
3.Createthezonerootdirectoryforthenewzonebeingcreated
#mkdir/zones3/oraclebi
#chmod700/zones3/oraclebi
#lsld/zones3/oraclebi
drwx2rootroot512Mar1215:41/zones3/oraclebi
4.Createanew (empty,nonconfigured)zone in theusualmannerwith theeditedconfiguration fileasaninput
#zonecfgzoraclebif/tmp/siebeldb.config.cfg
#zoneadmlistcv
IDNAMESTATUSPATHBRANDIP
0globalrunning/nativeshared
siebeldbinstalled/zones/dbservernativeexcl
oraclebiconfigured/zones3/oraclebinativeexcl
5.Ensurethatthezoneyouintendtoclone/copyisnotrunning
#zoneadmzsiebeldbhalt
6.Clonetheexistingzone
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 31/36
#zoneadmzoraclebiclonesiebeldb
Cloningzonepath/zones/dbserver...
Thissteptakesatleast5minutestoclonethewholezone.Largerzonesmaytakelongertocompletethe
cloningprocess.
7.Bootthenewlycreatedzone
#zoneadmzoraclebiboot
Bringupthehaltedzone(thesourcezone)aswell,ifwish.
8.LogintotheconsoleofthenewzonetoconfigureIP,networking,etc.,andyouaredone.
#zloginCoraclebi
[New:07/15/2009]
MigratingaNonGlobalZonefromOneHosttoAnother
Keywords:Solaris,NonGlobalZone,Migration,Attach,Detach
The following instructions demonstrate how to migrate the nonglobal zone, orabi to another server withexamples.
#zoneadmlistcv
IDNAMESTATUSPATHBRANDIP
0globalrunning/nativeshared
4siebeldbrunning/zones/dbservernativeexcl
orabiinstalled/zones3/orabinativeshared
1.Haltthezonetobemigrated,ifrunning
#zoneadmzorabihalt
2.Detachthezone.Oncedetached,itwillbeintheconfiguredstate
#zoneadmzorabidetach
#zoneadmlistcv
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 32/36
IDNAMESTATUSPATHBRANDIP
0globalrunning/nativeshared
4siebeldbrunning/zones/dbservernativeexcl
orabiconfigured/zones3/orabinativeshared
3.Movethezonepathforthezonetobemigratedfromtheoldhosttothenewhost.
Dothefollowingontheoldhost:
#cd/zones3
#tarEcforabi.tarorabi
#compressorabi.tar
#sftpnewhost
Connectingtonewhost...
sftp>cd/zones3
sftp>putorabi.tar.Z
Uploadingorabi.tar.Zto/zones3/orabi.tar.Z
sftp>quit
Onthenewhost:
#cd/zones3
#uncompressorabi.tar.Z
#tarxforabi.tar
4.Onthenewhost,configurethezone.
Createtheequivalentzoneorabionthenewhostusethezonecfgcommandwiththeaoptionandthe
zonepathonthenewhost.Makeanyrequiredadjustmentstotheconfigurationandcommittheconfiguration.
#zonecfgzorabi
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 33/36
orabi:Nosuchzoneconfigured
Use'create'tobeginconfiguringanewzone.
zonecfg:orabi>createa/zones3/orabi
zonecfg:orabi>info
zonename:orabi
zonepath:/zones3/orabi
brand:native
autoboot:false
bootargs:
pool:
limitpriv: all,!sys_suser_compat,!sys_res_config,!sys_net_config,!sys_linkdir,!sys_devices,!sys_schedulingclass:
iptype:shared
inheritpkgdir:
dir:/lib
inheritpkgdir:
dir:/platform
inheritpkgdir:
dir:/sbin
inheritpkgdir:
dir:/usr
net:
address:IPaddress
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 34/36
physical:nxge1
defrouternotspecified
zonecfg:orabi>setcappedmemory
zonecfg:orabi:cappedmemory>setphysical=8G
zonecfg:orabi:cappedmemory>end
zonecfg:orabi>commit
zonecfg:orabi>exit
5.Attachthezoneonthenewhostwithavalidationcheckandupdatethezonetomatchahostrunninglater
versionsofthedependentpackages
#lsld/zones3
drwxrwxrwx5rootroot512Jul1512:30/zones3
#chmodgw,ow/zones3
#lsld/zones3
drwxrxrx5rootroot512Jul1512:30/zones3
#zoneadmzorabiattachu
Gettingthelistoffilestoremove
Removing1740files
Remove607of607packages
Installing1878files
Add627of627packages
Updatingeditablefiles
Thefilewithinthezonecontainsalogofthezoneupdate.
#zoneadmlistcv
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 35/36
IDNAMESTATUSPATHBRANDIP
0globalrunning/nativeshared
orabiinstalled/zones3/orabinativeshared
Note:
Itispossibletoforcetheattachoperationwithoutperformingthevalidation.Youcandosowiththehelpof
Foption
#zoneadmzorabiattachF
Becarefulwhenusingthisoptionbecauseitcouldleadtoanincorrectconfigurationandanincorrect
configurationcouldresultinundefinedbehavior
[New:07/19/2009]
Tip:HowtofindoutwhetherconnectedtotheprimaryOSinstanceorthevirtualinstance?
Ifthecommandzonenamereturnsglobal,thenyouareconnectedtotheOSinstancethatwasbootedfromthe
physical hardware. If you see any string other than global, you might have connected to the virtual OSinstance.
AlternativelytryrunningprstatZorzoneadmlistcvcommands.IfyouseeexactlyonenonzeroZoneID,it
isanindicationthatyouareconnectedtoanonglobalzone.
Suggestedreading:
SystemAdministrationGuide:SolarisContainersResourceManagementandSolarisZones
ZonesandContainersFAQatopensolaris.org
Zones:UnofficialFAQ
Technoratitags
SolarisOpenSolarisZones
-
02/06/14 Solaris Zones
bravolinux.blogspot.mx/2010/03/solaris-zones.html 36/36
Posted10thMarch2010byRetheshNair
Labels:SolarisZones
Enteryourcomment...
Commentas: GoogleAccount
PublishPublish
PreviewPreview
0 Addacomment