Migrate OpenVZ VM to Xen Print

  • 0

1. Create Xen VM with similar specs as original OpenVZ VM. Ensure Xen VM can boot and SSH OK.

2. Shutdown both VMs.

3. Backup Xen VM.
- SSH Destination Xen node ( e.g. server09 )
- Identify VM ID from SolusVM
# cd /home/xen/VMID
# grep disk VMID.cfg
ramdisk = '/boot/solus-initrd.img'
disk = ['phy:/dev/VolGroup00/vm307_img,sda1,w', 'phy:/dev/VolGroup00/vm307_swap,sda2,w']
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Copy this disk image device, and paste to mount it as below:-
# mount /dev/VolGroup00/vm307_img ./mnt
# df -h
.....
/dev/mapper/VolGroup00-vm307_img
15G 631M 14G 5% /home/xen/vm307/mnt
- Make backup of original Xen VM:-
# cd /home/xen/VMID
# cp -ai mnt mnt.orig

4. Transfer Source VM to Destination VM
- SSH Source OpenVZ node ( e.g. server04 )
- Identify VM ID (VZID) from SolusVM
- Create exclusion files list:-
# vim /root/exclude.txt
[ For CentOS: See APPENDIX I ]
[ For Ubuntu / Debian: See APPENDIX II ] 
:wq
- Perform the transfer ( Use private IP address of destination Xen node, e.g. for server09, use 10.0.28.39 ):-
# rsync --exclude-from="/root/exclude.txt" --delete --numeric-ids -avpogtStlHz -e "ssh -p 22222" /vz/private/VZID/ 10.0.28.39:/home/xen/VMID/mnt/

5. Unmount destination VM and boot new VM.
- SSH Destination Xen Node
- Unmount destination Xen VM
# umount /home/xen/VMID/mnt
- Boot VM via SolusVM
- Verify all OK

6. Backup and Remove old OpenVZ VM
- SSH Source OpenVZ Node
# cd /vz/private
# cp -ai VZID VZID.backup
- Remove Source OpenVZ Node via SolusVM.

DONE.

TROUBLESHOOTING NOTES:-

1. When booting new Xen VM, watch the Xen Console and see if any kernel modules failing to load due to file not found, e.g.:-

- SSH destination Xen Node
# xm console VMID

modprobe: FATAL: Could not load /lib/modules/2.6.18-194.26.1.el5xen/modules.dep: No such file or directory

- If so, copy the desired node kernel modules from node to VM

- Shutdown VM
- Mount VM storage (see above)
- Copy kernel modules from node
# rsync -av /lib/modules/2.6.18.xxxxxxx /home/xen/VMID/mnt/lib/modules/
- Unmount storage ( see above)
- Boot VM and confirm no more kernel load errors.


APPENDIX 1: /root/exclude.txt : CentOS VM

/boot
/proc
/sys
/tmp
/dev
/var/lock
/etc/fstab
/etc/mtab
/etc/resolv.conf
/etc/conf.d/net
/etc/network/interfaces
/etc/networks
/etc/sysconfig/network*
/etc/sysconfig/hwconf
/etc/sysconfig/ip6tables-config
/etc/sysconfig/kernel
/etc/hostname
/etc/HOSTNAME
/etc/hosts
/etc/modprobe*
/etc/modules
/net
/lib/modules
/etc/rc.conf
/usr/share/nova-agent*
/usr/sbin/nova-agent*
/etc/init.d/nova-agent*
/etc/ips
/etc/ipaddrpool
/etc/ips.dnsmaster
/etc/resolv.conf
/etc/sysconfig/network-scripts/ifcfg-eth0


APPENDIX 2: Ubuntu / Debian VM

/etc/fstab
/etc/securetty/boot
/etc/inittab
/etc/network
/proc
/lib/modules
/sys
/etc/resolv.conf
/etc/hosts


Was this answer helpful?

« Back