cloning a solaris zone

5
Cloning a Solaris Zone I tried out cloning on a Solaris Zone today and it was a breeze, so much easier (and far, far quicker) than creating another zone from scratch and re-installing all the same users, ackages, ort lock-downs etc! "ere are my notes from the e#ercise$ Existing System Setup Sun%ire &' with a single sarse root zone ( zone1) installed in e#ortzoneszone'! &he ob*ecti+e is to create a clone of zone' called zone but using a different I address and hysical network ort! I am not using any Z%S datasets (yet)! Procedure '! .#ort the configuration of the zone you want to clonecoy # zonecfg -z zone1 export > zone2.cfg ! Change the details of the new zone that differ from the e#isting one (e!g! I address, data set names, network interface etc!) # vi zone2.cfg /! Create a new (emty , unconfigured) zone in the usual manner based on this configuration fil e # zonecfg -z zone2 -f zone2.cfg 0! .nsure that the zone you intend to clonecoy is not running # zoneadm -z zone1 halt 1! Clone the e#isting zone # zoneadm -z zone2 clone zone1 Cloning zonepath /export/zones/zone1... This took around minutes to clone a 1!" zone see notes $elo%& 2! 3erify both zones are correctly installed # zoneadm list -vi '( )*+, T*T *T0 glo$al running / - zone1 installed /export/zones/zone1 - zone2 installed /export/zones/zone2 4! 5oot the zones again (and re+erify correct status) # zoneadm -z zone1 $oot # zoneadm -z zone2 $oot # zoneadm list -vi '( )*+, T*T *T0

Upload: suman

Post on 01-Jun-2018

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Cloning a Solaris Zone

8/9/2019 Cloning a Solaris Zone

http://slidepdf.com/reader/full/cloning-a-solaris-zone 1/5

Page 2: Cloning a Solaris Zone

8/9/2019 Cloning a Solaris Zone

http://slidepdf.com/reader/full/cloning-a-solaris-zone 2/5

glo$al running /

zone1 running /export/zones/zone1

zone2 running /export/zones/zone2

6! Configure the new zone +ia its console (+ery imortant)

# zlogin -C zone2

&he abo+e ste is required to configure the locale, language, I settings of the new zone! It also creates the

system-wide 7S8 key airs for the new zone, without which you cannot SS" into the zone! If this ste not done,

many of the ser+ices on the new zone will not start and you may obser+e etc!9:C;:%I<97.= errors in certain

log files!

Summary

>ou should now be able to log into the new zone, either from the root zone using zlogin or directly +ia ssh (of

configured)! 8ll of the software that was installed in the e#isting zone was resent and accounted for in the new

zone, including S?% ser+ices, user configuration and security settings etc!

Notes

If you are using Z%S datasets in your zones, then you may see the following error when trying to e#ecute the

clone command for the newly created zone$

Could not verif3 zfs dataset tank/xxxxx4 mountpoint cannot $e inherited

zoneadm4 zone xxxxx failed to verif3

&o resol+e this, you need to ensure that the mountoint for the data set (i!e! Z%S artition) being used has been

e#licitly set to none! .+en though the outut from a zfs list command at the global zone might suggest

that it does not ha+e a mount oint, this has haened to me a number of times and in each case, the following

command did the trick for me$

# zfs set mountpoint5none tank/xxxxx

Easy! 

'1 7esonses to @Cloning a Solaris ZoneA

'! Jamie Says$

Buly 'th, 4 at '$/ m

:ice one Bames!

! larryone Says$

;ctober th, 4 at '$1 m

will the two zones not end u ha+ing the same i address in this scenarioD (assuming youEre on static i

addresses)

/! James Mernin Says$;ctober nd, 4 at ''$10 am

Page 3: Cloning a Solaris Zone

8/9/2019 Cloning a Solaris Zone

http://slidepdf.com/reader/full/cloning-a-solaris-zone 3/5

>es, they will! "owe+er, this can be changed either before booting the new zone (using the zonecfg command) or 

manually *ust after the new zone is booted (best to shut down coied zone here though)!

&his is not the only otential side-effect of cloning as other configuration files (e!g! ?ySFG) may ha+e fi#ed

references that need to be udated by hand!

"owe+er, if circumstances ermit it, cloning is still and e#cellent feature and can sa+e a log of time!

0! Steve Foubister  Says$

 8ugust 0th, 6 at ''$0/ am

7egarding i address, surely *ust easier to modify it in the zone!cfg file you created in ste 'D

1! James Mernin Says$

 8ugust 1th, 6 at 4$' m

Ste+e,

>ou are correct, and I did allude to this in Ste (maybe it could ha+e been clearer though)! "owe+er, frommemory, I think you still need to carry out the @zlogin -CA ste to roerly configure some of the other system-

wide settings correctly!

2! Claudio Says$

=ecember 1th, 6 at $/ m

&hanksH 3ery useful articleH &hanksH

4! Steve Says$

?ay th, at /$00 m

ill the clone be able to clone data on raw de+ices resented to zone'! In articular a sybase ser+er with rawresented +ia +#+mD

6! Michael Says$

Buly th, at 6$ m

I would like to e#ort the zone config from one host, and read it into another host! &hen, IEd like to mount the zone

on the new host, using S7=% S8: luns (i!e! .?C 7 luns that were slit off), in case of a disaster! ill this workD

;b+iously other things need to be done, including changing Is,!!etc!

I donEt want to clone the zone er se because that would require that the cloned zone ha+e its own disk

resources! I want to use the 7 luns, including the ;S lun!

! James Mernin Says$

=ecember 'st, at '$2 m

Ste+e,

 8ologies for the late rely but I +ery much doubt that you can clone data on raw de+ices at the same time as

cloning your zone! ;f course I donEt know this for sure but am *ust surmising based on other knowledge about

cloning and migrating zones!

If you consider how zones are actually managed, theyEre *ust a bunch of files in a certain directory, carefully

managed by the global zone, So cloning a zone is +ery *ust a matter of making a coy of these files! So ask

yourself if you can do this with raw data in the same wayD

 8lso, I had roblems recently when I tried to migrate a zone with a dataset configured from one system to

another! I found that I had to dismount any datasets used by the zone before detaching it from the source

system! ;therwise, it would look for (and ossibly try to mount) a dataset of the same name on the target system!

Page 4: Cloning a Solaris Zone

8/9/2019 Cloning a Solaris Zone

http://slidepdf.com/reader/full/cloning-a-solaris-zone 4/5

'! Cyril.Galibern Says$

?ay 'th, ' at 6$/ m

e are working on oens+c roduct that hel in cloning solarisoensolaris zones, Ginu# container J+m , "+m!

ith S7=%:eta, Z%S!

>ou may ha+e a look on htt$www!oens+c!com

''! hana Says$

Banuary /rd, '' at $10 am

3ery useful article!! &hanks

'! Gary ! Says$

Bune 6th, '' at '$/0 m

?any thanks!! +ery useful

'/! C"#NE S#"$%&S '#NES(C#N)$&NE% * Just )echnical &n+ormationSays$

Buly 2th, '' at '$0 am

K!!!L I:%; <.& %7;?$htt$www!mernin!comblog44cloning-a-solaris-zoneK!!!L

'0! ,eri Says$

;ctober '0th, '' at 2$0 m

3ery, 3ery useful! &hanks for the details!

'1! http-((tinyurl.com(atelinch/01/1  Says$

%ebruary /rd, '/ at 6$ am

&hanks a lot for sending time to write @Cloning a Solaris ZoneA!

&hank you once more ,?oshe

Gea+e a 7ely

7enaming a Solaris zone

 TechnologyAdd comments

I needed to rename a zone on a Solaris 10 system earlier this week and here are some notes

on how I did it.

The process of renaming a zone is essentially a task of renaming, editing and replacing

strings in a series of (mostly XM! config"ration files. #ll of the tasks $elow were carried

o"t from the glo$al zone on the system in %"estion.

1. Shut down the zone to be renamed

Page 5: Cloning a Solaris Zone

8/9/2019 Cloning a Solaris Zone

http://slidepdf.com/reader/full/cloning-a-solaris-zone 5/5

# zoneadm -z 6oldname> halt

2. Modify the configuration files that store the relevant zone configuration

# vi /etc/zones/index

&hange all references of 'oldname to 'newname as appropriate# cd /etc/zones

# mv 6oldname>.xml 6ne%name>.xml

# vi 6ne%name>.xml

&hange all references of 'oldname to 'newname as appropriate

3. Rename the main zone path for the zone

# cd /export/zones

# mv 6oldname> 6ne%name>

)o"r zone path may $e different than the one shown a$o*e

4. Modify networ!" configuration files of new zone

+epending on the applications installed in yo"r zone, there may $e se*eral files yo" need to

"pdate. The essential networking files are

# cd /export/zones/6ne%name>/root

# vi etc/hosts

# vi etc/nodename

-"t others containing yo"r old hostzone name can also $e fo"nd "sing this command

# cd /export/zones/6ne%name>/root/etc

# find . -t3pe f 7 xargs grep 6oldname>

#. $oot the new zone again# zoneadm -z 6ne%name> $oot