This post illustrates a simple and efficient way of migrating a cloned zone instead of a sparsed root zone, on a sparsed root zone you simply snapshot the dataset and use zfs send and receive via ssh to transfer it over. However it will not work with a cloned zone, so this is a possible way of migrating
Firstly take a record of the info on the zone configuration so that you can configure it the same on the destination server.
# zonecfg –z testzone
zonecfg:testzone> info
Halt and detach the zone:
# zoneadm –z testzone halt
# zoneadm –z testzone detach
The most crucial file in this procedure is the detached xml file which can be located within the zones directory (SUNWdetached.xml) make sure this is generated before archiving and zipping. Change into to the directory where all your zonepaths are stored and perform the following commands to archive and zip the zone directory:
e.g.
# cd /pool/zones
# tar –cvf testzone.tar testzone/*
# gzip testzone.tar
The next step is to send over the zipped and archived file via scp to the destination global host
# scp testzone.tar.gz root@[IPADDROFHOST]:/path/to/zones
Once the file has been sent over, login to the server and locate to the zone directory. Unzip and untar the file using the following commands:
# gunzip testzone.tar.gz
# tar –xvf testzone.tar
Next we want to rename the current zone directory, create the new zfs filesystem and copy the contents of testzones directory into its zfs filesystem mountpoint. Perform the following commands:
e.g.
#mv testzone testzone2
# zfs create pool/zones/testzone
# mv testzone2/* testzone
Make sure you change into the testzone directory and unzip the detached xml file as this will be compressed, if this is not done you will not be able to attach the zone.
# cd testzone
# gunzip SUNWdetached.xml.gz
The zone directory must not be readable or writable by group or other so change the permissions to 700
# chmod 700 testzone
Now its time to create the zone and attach it
# zonecfg -z testzone
testzone: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:testzone> create –a /path/to/zone
zonecfg:testzone> info
At this point make sure all the configuration in terms of networking, package inheritance and resource are correct and are familiar to the original zone.
zonecfg:testzone> commit
zonecfg:testzone> exit
# zoneadm –z testzone attach –u
If that does not work, use the –F switch to force the attachment
# zoneadm –z testzone boot
# zlogin testzone
Have a look around the service management facilities and check that common configuration is correct. And you are good to go.
Cloud, DevOps, Platform Engineering and generally making assembly lines for developers
Subscribe to:
Posts (Atom)
Platform Engineering: Developer Experience
Intro The role of Platform Engineer as evolved through the ages. I’ve gone through all the names: Sys Admin, Infrastructure Engineer, DevOps...
-
22/02/17: Update to the template including support for EMR 5 and task node functionality for processing (task nodes optional) I've bee...
-
This post illustrates how to migrate a Solaris zone from one global host to another using zfs send and receive via ssh. This procedure is ve...