Steps assume advanced VMware and Xen knowledge.
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 5 as a guest does 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. Download a kernel with the same version number and architecture as the xen kernel, except it should be the generic kernel
2. Use RPM tools to install the kernel.
3. Modify /etc/modprobe.conf (this step is specific to RHEL 5 Xen VM because RHEL5 will not load LSI scsi modules during boot)
add:
alias eth0 e1000
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
optionally remove:
alias scsi_hostadapter xenblk
4 Backup the old initrd file in /boot
5. Update initrd with the following command mkinitrd /boot/initrd-kernelversion.img /boot/kernelversion ex. kernelversion=2.6.18-92.el5
6. Test the new kernel by booting Xen in fully virtualized mode.
7. Port the disk over as outlined below.
Xen -> VMware VM migration steps (DISK step)
Packages
1. Download qemu from DAG repository. http://dag.wieers.com/rpm/packages/qemu/qemu-0.9.0-2.el5.rf.x86_64.rpm
2. Download VMware Server 2.0
3. Provision a real machine with RHEL5.X or Centos 5.X and install both rpms.
Steps
1. Convert raw .img file to .vmdk file using qemu-img. qemu-img convert testvm.img -O vmdk testvm.vmdk
The vmdk file will be the following format.
0 : single growable virtual disk (IDE, VM hardware type 4)
1 : growable virtual disk split in 2GB files
2 : preallocated virtual disk
3 : preallocated virtual disk split in 2GB files
4 : preallocated ESX-type virtual disk
5 : compressed disk optimized for streaming
Fast Steps (for testing)
A2. Convert .vmdk file to the proper format using vmware-vdiskmanager, vmware-vdiskmanager -r testvm.vmdk -t 4 testvmesx.vmdk
The resulting file(s) will be the following format.
0 : single growable virtual disk
1 : growable virtual disk split in 2GB files
2 : preallocated virtual disk
3 : preallocated virtual disk split in 2GB files
4 : preallocated ESX-type virtual disk (IDE, VM hardware type 4) Not supported by VMware ESX! but works..
5 : compressed disk optimized for streaming
A3. Provision a machine on ESX server and add the disk, VMware will warn the user that the disk geometry is IDE and its using a SCSI controller to access the disk.
Correct Steps
B2. Provision a VM on the VMware Server that can be used for disk imaging. VMware Server supports both IDE and SCSI drives. It is required to do the disk imaging inside a VM because the VM will not see the VMware disk metadata and will treat the disk as a regular block device.
B3. Create a SCSI disk of the same (virtual) size as the converted .vmdk disk.
B4. Add both SCSI disk and the converted IDE disk to the vm.
B5. Use the VM to dd / winimage the source converted IDE disk to the target SCSI disk. The SCSI disk will now have the data from the IDE disk.
B6. Convert the new .vmdk file to the proper format using vmware-vdiskmanager http://vmware-vdiskmanager -r testvmscsi.vmdk -t 4 testvmesx.vmdk
The resulting file(s) will be the following format.
0 : single growable virtual disk
1 : growable virtual disk split in 2GB files
2 : preallocated virtual disk
3 : preallocated virtual disk split in 2GB files
4 : preallocated ESX-type virtual disk (SCSI, VM hardware type 7) Not supported by VMware ESX!
5 : compressed disk optimized for streaming
B7. Open up the *.vmdk meta file. It will be the small file that doesn't have 'flat' as a part of the filename and change db.virtualHWVersion = "X" to 4. The resulting file is supported by ESX server.
B8. Provision a machine on ESX server and add the disk.
B9. If source machine was a XEN para-virtualized machine it will probably try to boot to the XEN kernel by default. If a boot manager is installed it will go back to the grub kernel selection screen where the non XEN kernel can be booted from.
B10. Remove the Xen kernel to streamline the boot process
This document was generated from the following thread: Steps for taking a XEN paravirtualized RHEL 5.X to VMware ESXi 3.5.X vm