sábado, 19 de octubre de 2013

How to migrate from KVM-libvirt to PROXMOX

I partially answered my own question. Yes for option one but I am using identical servers. What if the servers were not identical? Should the VM work when moved?

Anyway, if it helps anyone, here is what I did to move a Win2000 VM from a kvm-based Ubuntu 9.04-server amd64 to a server running proxmox 1.4 beta2. My transfer medium was an external usb drive formatted using ext3.

#Backup On Prod Server
# Plug in usb drive and locate drive. You might want to use fdisk to help. In fdisk type 'p' to list partitions. 'm' for help.
fdisk /dev/sdb
# mount drive if not mounted
mkdir /mnt/drive2
sudo mount /dev/sdb1 /mnt/drive2

# Find LVM file to copy
sudo lvdisplay
sudo dd if=/dev/vmgroup/vm52 of=/mnt/drive2/vm_2000.dd
ls -lh /mnt/drive2/
sudo umount /mnt/drive2

#Migrate to New Server
# Plug in usb drive and locate drive. See directions above
mkdir /mnt/drive2
sudo mount /dev/sdb1 /mnt/drive2
ls -lh /mnt/drive2/

# Locate desired VM to replace and rename. They are in the images folder.
ls -hl /var/lib/vz/images/103
mv /var/lib/vz/images/103/*.raw /var/lib/vz/images/103/vm-103-disk-1.raw.back

# Copy the external usb file to the proxmox lvm
dd if=/mnt/drive2/vm_2000.dd of=/var/lib/vz/images/103/vm-103-disk-1.raw

# Clean-up
rm /var/lib/vz/images/103/vm-103-disk-1.raw.back

# Unmount
sudo umount /mnt/drive2

Enjoy!

Oslo