How To Convert A Xen Virtual Machine To VMware
This article explains how you can convert a Xen guest to a VMware guest. The steps descibed here assume advanced VMware and Xen knowledge.
Additional software requirements:
- qemu
- VMware Server 1.xx
- VMware Converter
- Knoppix LiveCD or the distribution's first CD
Xen -> VMware VM Migration Steps (Kernel Step)
The kernel on the VM to be migrated must support fully virtualized operation. The kernels used for para-virtulized machines using RHEL/Fedora/CentOS as a guest do not support fully virtualized operation by default. The best way to deal with this is to also install a standard kernel in the machine, port the machine and finally remove the Xen kernel.
1. Since this is a highly risky procedure, FIRST CREATE A BACK-UP OF YOUR VIRTUAL MACHINE!!!
2. Download a kernel with the same version number and architecture as the Xen kernel, except it should be the a generic one. Use the distribution CD/DVD or any other repository to get it.
3. Use RPM tools to install the kernel.
4. Modify /etc/modprobe.conf to add the proper SCSI and network card modules:
alias eth0 xennet alias scsi_hostadapter xenblk
will be replaced by
alias eth0 pcnet32 alias scsi_hostadapter mptbase alias scsi_hostadapter1 mptspi alias scsi_hostadapter2 ata_piix
Modify /etc/inittab by removing the # in front of the getty and puting a comment in front of the line containg the xen console:
1:2345:respawn:/sbin/mingetty --noclear tty1 2:2345:respawn:/sbin/mingetty 3:2345:respawn:/sbin/mingetty 4:2345:respawn:/sbin/mingetty 5:2345:respawn:/sbin/mingetty 6:2345:respawn:/sbin/mingetty
This is a one way action. Once modified the kernel modules, you won'tbe able to properly start the machine, and you will receive a Kernel panic error message.
Xen - > VMware VM Migration Steps (Disk Step)
To convert a XEN machine in a .vmdk format to be used with VMware, a tool called qemu will be used. QEMU is a generic and open source machine emulator and virtualizer. It is also a fast processor emulator using dynamic translation to achieve good emulation speed.
1. Download qemu from DAG repository. Use the EL5 package for any Fedora/RHEL5/CentOS5 that you use.
http://dag.wieers.com/rpm/packages/qemu/
2. Convert the XEN machine to VMware:
qemu-img convert <source_xen_machine> -O vmdk <destination_vmware.vmdk>
3. At this point, we have a valid VMware Server 1.xx disk image. This can be powered on onto any VMware Server. We need to do it anyway in order to build a .VMX file that will be later used. This stage also confirms whether the newly machine runs properly.
3.1 Create a new virtual machine. Do not create a new HDD, but use the previously created vmdk.
3.2 Power it on in order to validate that it is usable and to allow the machine to reconfigure itself.
4. Move the VMware Server virtual machine to a Windows workstation running VMwareConverter.
5. Using VMware Converter, convert the VMware Server virtual machine to VMware ESXi.
Xen -> VMware VM Migration Steps (ESX Step)
1. Configure the virtual machine to boot first from CD-ROM drive.
2. Modify the machine's HDD SCSI controller type from BUS Logic to LSI Logic.
Edit Virtual Machine Settings > SCSI Controller 0 > Change type > LSI Logic.
3. Boot using Knoppix or the distribution's first CD.
4. Mount the VM's disk and chroot to it.
5. Get the disk architecture using fdisk -l, and modify /etc/fstab accordingly.
6. Create a new initrd image. You also must know the version of the running kernel. For example, if you are running kernel 2.6.18-1234, then the initrd command would look like this:
# mkinitrd -v -f /boot/initrd-2.6.18-1234.img 2.6.18-1234
7. Edit /boot/grub/menu.lst to boot from this initrd.
8. Keep your fingers crossed and reboot the machine.
Don't forget to re-configure your network card.
External references:
http://communities.vmware.com/docs/DOC-8300