Tuesday, January 19, 2016

CentOS V2V | Hyper-V to VMware - The easy way

I had a task to export a Hyper-V, CentOS 6 VM and deploy it to a vSphere cluster. Due to the nature of the VM we had to preserve it because the VM was already set up and it was too long for us to build a new one with the same settings.

Before start I would like to point out that if this is a Linux VM you are doing, then because there will be a complete hardware change you may end up with unbootable clone, which can be fixed. This did not happen to me though, but in the end of this article I will also point those things out as potential issues.

So let us begin:

1. Export the VM from the Hyper-V host

For those of you familiar with Hyper-V the export feature on the VM comes in really handy, and after it finishes you are left with the VM to import. Among the files you can find the VHD hard disk file and that is all you need to proceed further. We can use that VHD and convert it to VMDK disk file which is the VMware disk format.

You can use any software to converted the disk from VHD to VMDK. The software which I used was called StarWind V2V Converter.

2. Convert the VHD disk to VMDK disk type:

Use the StarWind converter or something else of your choice to convert the disk to VMDK. We will use that VMDK to create our VM.

3. Upload the disk type to the vSphere Datastore

This is pretty much straightforward. After the upload is finished we can begin with creating our VM.

4. Recreate the VM in the vSphere

This is something that you should be careful with. Because this is a Linux VM in question we have to be careful to match the hardware on the first start.

Check and verify the settings with the original VM from the Hyper-V. Make sure that you match the number of CPUs. I would recommend to match the number of Network Cards as well.

Now recreate the VM with those same settings. After the initial boot you can add more CPU sockets and other hardware.

Remove the original disk and select the Existing Hard Disk option and select the VMDK disk you previously uploaded.

5. Power on the VM

After you power on the VM if the power on is successful and the VM boots successfully then you are done. In many cases you may end up without network connection on the VM. If that is the case than just create a new ifcfg-ethX file in /etc/sysconfig/network-scripts with your desired settings.

Alternatively there are two boot related potential problems that can occur at this time.

If you are experiencing boot problems than read on:

Boot problem 1 - Unable to power on the VM in the vSphere client

Depending on the settings that you've chose during the conversion of the VHD to VMDK you may end up with a VMDK that is for VMware Workstation rather then for ESXi. When you attempt to power on that VM you will end up with an error message:

Failed to open disk scsi0:0: Unsupported or invalid disk type 7. Ensure that the disk has been imported.

In that case follow this guide on the VMware KB (KB 1028943) which tells you how to convert the VMDK from VMware Workstation type to ESXi type.

Basically you can use either the ESXi command line or VMware Converter to do that. I would recommended using the ESXi CLI commands but if you are afraid of the CLI than you may use the VMware Converter as well.

This is what I would do, and it would be supper easy and fast:

WARNING: The bellow procedure will clone the existing disk. Make sure that you have enough space on the datastore or if you are short on space you may end up filling all of the space.

# cd /vmfs/volumes/f614ea11-a1d75394/VMCentos
/# vmfs/volumes/f614ea11-a1d75394/VMCentos # vmkfstools -i vmcentos.vmdk vmcentos-new.vmdk
Destination disk format: Thin
Cloning disk 'vmcentos.vmdk'...
Clone: 100% done.

Boot problem 2 - The VM Powers on successfully and begins the booting process but suddenly halts with a kernel panic error

This is true if the VM you are converting is a Linux VM. If you receive a kernel panic on boot then you have to regenerate the initrd image.

Use this article to do that:

CentOS Tip and Tricks | Creating a New Initial RAM Disk

It is recommended that if you are doing this you use the exact same installation disk, for the exact same Linux version.


  1. I admire the valuable information you offer in your articles. I will bookmark your blog and have my friends check up here often. I am quite sure they will learn lots of new stuff here than anybody else! Regards, vmware jobs in hyderabad

  2. Yeah, converting VM's is not that easy, thanks for sharing a guide.

    vSphere replication


  3. Thanks for sharing such a good content with us. keep share these kind of content.i would like to read more.
    VMware Training in Delhi