In the world of virtualization, it is not uncommon that an engineer or their team be tasked with converting a machine from a physical environment or a different hypervisor into VMware. Procedures abound in how to P2V a Physical server into VMware, or how to V2V Hyper-V into VMware. There are even procedures on how to V2V a Windows VM from Citrix XenServer to VMware.

There are even procedures on how to V2V servers from VMware to XenServer!

But finding reliable documentation on how to V2V a Linux VM from XenServer to VMware proves challenging.

Linux VMs present a unique use-case challenge to the virtualization engineer, because XenServer inserts several Xen-flavored modules directly into the Linux kernel with its paravirtualized drivers. You can use a tool like VMware vCenter Standalone Converter to just convert a Linux VM from XenServer to VMware, but the VM will not boot in the VMware environment.

So how does one convert a Linux VM from Citrix XenServer to VMware? Can it be done?

It can.

Essentially, the Xen-flavored Linux kernel needs to be replaced with a vanilla Linux kernel.

There are several examples available on the web of older versions of RHEL being converted, but none that address newer versions. Behold!

I got this to work through trial and error, and was able to successfully convert a RHEL 6.6 VM several times.

Steps to Perform on the Source VM

1.Log in to Linux machine as root.

2. Make a new directory for the Linux ISO.

-# mkdir /mnt/iso

3. Copy install media to /mnt/iso with SCP or other method.

4. Mount ISO;

# mount -t iso9660 -o loop /mnt/iso/rhel-server-6.6-x86_64-dvd.iso /mnt/iso

5. Determine which kernel packages are installed

# rpm -q kernel*

6. Install the vanilla Linux kernel.

# rpm -ivh with –ignoresize and –force switches.

7. Remove old kernel with -e switch:

# rpm -e <old kernel>

8. Remove Xen Tools

rpm -e xe-guest-utilities-6.0.0-743.x86_64.rpm rpm -e xe-guest-utilities-xenstore-6.0.0-743.x86_64.rpm

9. Convert the VM with vSphere vCenter Converter. Be sure to give the helper VM a static IP and define the DNS Suffix! Watch it until it hits 5+% completion. If it fails before that, it’s due to either network issues or DNS.

Steps to Perform Post-Conversion

Attach RHEL 6.6 Install Media as ISO. Set VM to boot directly to BIOS – Elevate CDROM above HD in boot options. Boot VM with Rescue Media. Chroot to VM root (usually /mnt/sysimage) Run fdisk to verify partition integrity. -Verify that SDA1 is marked as bootable. Reboot. Hit shift to get to Grub Screen. Load Kernel, Root, and Initrd. Boot.

(If machine does not boot)

Remove all kernels. Remove the kernel-firmware too. Reinstall RHEL 6.6 kernel and kernel-firmware. Edit FSTab to rename /dev/xvd# to /dev/sd# where # indicates volume label. Install Grub w/ # grub-install /dev/sda –recheck Modify grub.conf Run Dracut -f -v Reboot (it might boot to a black screen; if so, power off and power on again. Then hit Shift on Splash screen, then c to get to Grub. Find the grub config file, enter the boot parameters and boot ala

# find (hd0,0)/grub/grub.conf # cat (hd0,0)/grub/grub.conf # kernel /vmlinuz (tab to complete) root= # initrd /initramf (tab to complete) #boot

8. Wait for the VM to boot in single user mode and find all partitions, verify file system, relabel SELinux. It will automatically reboot again.

9. If it still will not boot on its own, strip grub config down to minimal required parameters.

10. Login. Verify boot.

Once the VM is booting successfully, run df -h. Make sure file system is not full. If it is, expand it now. Remove the Rescue media.

Now you’re ready to install VMware Tools.

-Install Vmware Tools using compiler.

# mkdir /mnt/cdrom To mount the CDROM, run:



# mount /dev/cdrom /mnt/cdrom To copy the Compiler gzip tar file to a temporary local directory, run:



# cp /mnt/cdrom/VMwareTools-version.tar.gz /tmp/ To determine the version of VMware tools, run:



# ls /mnt/cdrom To change to the tmp directory and extract the contents of the tar file into a new directory called vmware-tools-distrib, run:



# cd /tmp # tar -zxvf VMwareTools-version.tar.gz To change directory to vmware-tools-distrib and run the vmware-install.pl PERL script to install VMware Tools, run:



# cd vmware-tools-distrib # ./vmware-install.pl

Accept the defaults. When VMware Tools is finished installing, unmount the install media.

# umount /mnt/cdrom

Reboot.

Once the VM comes back up, configure any networking that needs to be reconfigured, and test rebooting a few times.

With that, you have successfully converted a Linux VM from XenServer to VMware.