How to migrate non-global zone from one server to another.

In this article I am going to show you how to migrate non-global zone from one server to another when non-global zone is present on shared storage.

Most of the times we are doing this when we want to perform acitivity on server.

  • My Lab Set up
    VMware Workstation
    Node1 and Node2 Solaris 10 (Virtual Machines)
    Openfiler to provide the iSCSI LUN (192.168.120.134)

Kindly follow the below step by step approach to complete the activity succesfully.

Step 1 : Common step for both nodes. We are preparing our nodes to scan the LUN from ISCSI target making them as initiator. Before scanning I am having only disk on both servers.

bash-3.2# svcadm enable iscsitgt

bash-3.2# iscsiadm add static-config iqn.2006-01.com.openfiler:tsn.6cd2d6221dcd,192.168.120.134:3260
bash-3.2# echo | format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c1t0d0 <VMware,-VMware Virtual -1.0 cyl 2085 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@0,0
Specify disk (enter its number): Specify disk (enter its number):

Node2# iscsiadm modify discovery -s enable

Step 2 : After making both nodes as ISCSI intiator we can scan the LUN in both nodes using “devfsadm”. New LUN will appear in output of “echo | format” compare it with step 1.

Node2# devfsadm -i iscsi -v

Node2# echo | format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c1t0d0 <VMware,-VMware Virtual -1.0 cyl 2085 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@0,0
1. c2t2d0 <OPNFILE-VIRTUAL-DISK -0 cyl 1560 alt 2 hd 255 sec 63>
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.6cd2d6221dcd0001,0
Specify disk (enter its number): Specify disk (enter its number):

Node1# echo | format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c1t0d0 <VMware,-VMware Virtual -1.0 cyl 2085 alt 2 hd 255 sec 63>
/pci@0,0/pci15ad,1976@10/sd@0,0
1. c2t2d0 <OPNFILE-VIRTUAL-DISK -0 cyl 1560 alt 2 hd 255 sec 63>
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.6cd2d6221dcd0001,0
Specify disk (enter its number): Specify disk (enter its number):

Step 3 : I am going to configure the non-global zone named sharedzone1 on shared storage this needs to be done on only one node. I have create pool named zonepool1 on shared disk to use it as root for non-global zone.

Node2# zpool create zonepool1 c2t2d0

Node2# zonecfg -z sharedzone1
sharedzone1: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:sharedzone1> create -b
zonecfg:sharedzone1> set zonepath=/zonepool1/sharedzone1
zonecfg:sharedzone1> verify
zonecfg:sharedzone1> commit
zonecfg:sharedzone1> exit

Node2# zonecfg -z sharedzone1 info
zonename: sharedzone1
zonepath: /zonepool1/sharedzone1
brand: native
autoboot: false
bootargs:
pool:
limitpriv:
scheduling-class:
ip-type: shared
hostid:

Step 4 : After completing the configuration part starting with installation of zone on Node2. After the successful installation booting the zone to check whether installation went fine.

Node2# zoneadm -z sharedzone1 install
A ZFS file system has been created for this zone.
Preparing to install zone <sharedzone1>.
Creating list of files to copy from the global zone.

Node2# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– sharedzone1 installed /zonepool1/sharedzone1 native shared

Node2# zoneadm -z sharedzone1 boot

Node2# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
1 sharedzone1 running /zonepool1/sharedzone1 native shared

I login into zone and issue the poweroff command to bring the zone down.

Node2# zlogin sharedzone1
[Connected to zone ‘sharedzone1’ pts/2]
Last login: Sun Jul 27 04:48:08 on pts/2
Oracle Corporation SunOS 5.10 Generic Patch January 2005
# poweroff

[Connection to zone ‘sharedzone1’ pts/2 closed]
Node2# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– sharedzone1 installed /zonepool1/sharedzone1 native shared

Step 5: Now we need to copy the configuration(/etc/zones/sharedzone1.xml) from Node2 to Node1 at same location.

Node2# scp -p /etc/zones/sharedzone1.xml root@Node1:/etc/zones/

Step 6 : Detach the zone from Node2. After detaching it export the pool as well.

Node2# zoneadm -z sharedzone1 detach

Node2# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– sharedzone1 configured /zonepool1/sharedzone1 native shared

Node2# zpool export zonepool1
Node2# zpool list
no pools available

Step 7 : Now from here we will work on Node1. Check whether pool is available for import.

Node1# zpool import
pool: zonepool1
id: 13929165486904082896
state: ONLINE
action: The pool can be imported using its name or numeric identifier.
config:

zonepool1 ONLINE
c2t2d0 ONLINE

Step 8 : Now import the pool and attached the non-global zone.

Node1# zpool import zonepool1

(I am surprised to see the warning message during attach because I made clone copy of Node2 from Node1 strange but it will work)

Node1# zoneadm -z sharedzone1 attach
These packages installed on this system were not installed on the source system:
SUNWocmu (11.11,REV=2012.11.13.16.42)
SUNWperl-xml-parser (2.34,REV=10.0.3.2004.12.16.14.43)

On Node1 zone has come into installed state.

Node1# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
– sharedzone1 installed /zonepool1/sharedzone1 native shared

Step 9 : Able to successfully boot the non-global zone on second node 🙂

Node1# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / native shared
3 sharedzone1 running /zonepool1/sharedzone1 native shared

Oracle Tips : Here my environment was virtualized but in production environment sometime some kernel packages will be at different version on servers. In order to attach the non-global zones in such
situation we have below methods.

Solaris 10 10/08: Attach the zone with a validation check and update the zone to match a host running later versions of the dependent packages or having a different machine class upon attach.

zoneadm -z <zonename> attach -u

Solaris 10 9/10: Attach the zone with a validation check and update all of the packages for the zone, so that these packages match what would be seen with a newly installed non-global zone on this host.
Any packages installed inside the zone but not installed in the global zone are ignored and left as-is.

zoneadm -z <zonename> attach -U

Force attach of zones without performing validation check. This is dangerous one.

zoneadm -z <zonename> attach -F

 

Advertisements

2 thoughts on “How to migrate non-global zone from one server to another.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s