Xen Migration in between SolusVM Nodes




Step1: @Source Node


First of all login to the source Node.

Let you want to migrate the the VM, vm123.
Check the lvm partitions assigned for the VM, vm123. There will be a primary partitions, vm123_img and swap partition vm123_swap. You can check the details to these partitions using the following commands.

Note down the size of the VM and it's swap memory.


[root@source ~]# lvdisplay /dev/VolGroup00/vm123_img
--- Logical volume ---
LV Name /dev/VolGroup00/vm123_img
VG Name VolGroup00
LV UUID mmp1Jl-JhWN-FCzd-Gyqe-A8pF-LlvG-nfrpVx
LV Write Access read/write
LV Status available
# open 1
LV Size 20.00 GB
Current LE 640
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:10


[root@source ~]# lvdisplay /dev/VolGroup00/vm123_swap
--- Logical volume ---
LV Name /dev/VolGroup00/vm123_swap
VG Name VolGroup00
LV UUID hnZ0PL-k4y1-r3V3-2mVn-d8cK-gMGq-8JW3v1
LV Write Access read/write
LV Status available
# open 1
LV Size 512.00 MB
Current LE 16
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:11

Here vm123_img is a size of 20.00 GB and vm123_swap is a size of 512.00 MB.


Step2: @Source Node (Creating and mounting necessary LVs and creating Backup )

Create a logical volume to create and mount the backup. Give an additional 5GB space for the backup logical volume. Here in this case it is 25G after adding 5G space.

[root@source ~]# lvcreate -n vm123_backup --size 25G /dev/VolGroup00
[root@source ~]# mkfs.ext3 /dev/VolGroup00/vm123_backup
[root@source ~]# mkdir -p /home/xen/vm123_backup
[root@source ~]# mount /dev/VolGroup00/vm123_backup /home/xen/vm123_backup

It is need to shutdown the VM to create the backup.
[root@source ~]# xm shutdown vm123

Create backup of the logical voulume which mounted the vm123 using dd command.

[root@source ~]# dd if=/dev/VolGroup00/vm123_img of=/home/xen/vm123_backup/vm123_backup.img

Verify if the backup is in the location.

[root@source ~]# ls -lh /home/xen/vm123_backup


Step3: @Destination Node (Creating and Mounting necessary LVs)

In the destination it is needed to create 3 logical volumes. One for the backup, one for the vm itself and one for the swap memory. Here also backup LV is given additioanl 5G space. Compare the swap memory with the source server before creating swap memory.

[root@destination ~]# lvcreate -n vm123_backup --size 25G /dev/VolGroup00
[root@destination ~]# lvcreate -n vm123_img --size 20G /dev/VolGroup00
[root@destination ~]# lvcreate -n vm342_swap --size 512M /dev/VolGroup00

Make swap LV available for the swap space.

[root@destination ~]# mkswap /dev/VolGroup00/vm123_swap

Backup LV is creating and Mounting.

[root@destination ~]# mkfs.ext3 /dev/VolGroup00/vm123_backup
[root@destination ~]# mkdir -p /home/xen/vm123_backup
[root@destination ~]# mount /dev/VolGroup00/vm123_backup /home/xen/vm123_backup



Step4: @Source Node (Transferring backup)

[root@source ~]# scp -P 22 -C /home/xen/vm123_backup/vm123_backup.img root@<Destiantion server IP>:/home/xen/vm123_backup/


Step5: @Destination (Restoring)

[root@destination ~]# dd if=/home/xen/vm123_backup/vm123_backup.img of=/dev/VolGroup00/vm123_img


Now it is time to login to SolusVM Master Node.

Step 5: @SolusVM Master Node (To map the VM with new Hardware Node)

[root@SolusVM-Master ~]# /scripts/vm-migrate <VM ID> <New HN ID>


***Once you have done the above step, Reboot the VM via SolusVM cotrol panel. Just 'Boot' the server will not start the VM. You must click the 'Reboot' option.


Step6: @Destination node (new node). (Remove backups)

[root@destination ~]# umount /home/xen/vm179_backup
[root@destination ~]# lvremove /dev/VolGroup00/vm179_backup


Step7: @Source node (old node) Finally if migrated server is working fine, remove backups.

[root@source ~]# umount /home/vm179_backup
[root@source ~]# lvremove /dev/VolGroup00/vm179_backup
[root@source ~]# lvremove /dev/VolGroup00/vm179_img
[root@source ~]# lvremove /dev/VolGroup00/vm179_swap


That's it..

This entry was posted in by Arun Ghosh. Bookmark the permalink.