Do you find yourself needing to convert a virtual disk from one format type to another? Converting these files can be required when migrating your VM between different hosts, or if the file needs updating. Popular formats are VHDX and VMDK; however, not all products support this conversion process. Today's blog post discusses how Hyper-V Virtual Hard Disks (VHD) have been converted into VMware Format Disk Kits (.vmdk).
VMDK stands for virtual machine disk, and it is a file format similar to an .ISO. One can convert VHD files (virtual hard disks) to VMDK files, which means that one can create virtual machines from a disk image, without the need of having a physical hardware. Converting the disk images includes adding information such as boot sequence, etc., to allow the guest OS to run properly in the VM environment.
VHD stands for Virtual Hard Disk, which is a format that allows one to create a file on the disk instead of the partition. It is mainly used in Microsoft's Hyper-V server virtualization program and was originally known as Virtual Server Disk (VSD). A VHD can be assigned using all available space or it can be placed on different drives. Also, they are stored in .BIN files, so one cannot access them without mounting them.
Virtual hard disks are popular because they can be stored anywhere the physical host can access. These files have a maximum size value that specifies how large they will appear to virtual machines, but there are two types: fixed-size and dynamically expanding. Fixed size VHDs will automatically take up the specified amount of physical disk space on your host computer's file system whereas dynamic VHDs allocate space only as needed.
The VHD to VMDK conversion is needed when you are planning on migrating a virtual machine from one hypervisor to another. If the VM's disk format was incorrectly selected, then converting it can be helpful as well.
Check the VHD Content Before You Convert VHD to VMDK
Take this step as a precaution before converting a VHD to VMDK. It's to ensure that you're converting a healthy VHD file and that its content can be viewed too. By doing so, you can prevent yourself from wasting time and effort on converting the wrong VHD.
Here, we are using Ubuntu Linux to run qemu-img.
First of all, you need to install it from online repositories using the following command:
sudo apt-get install qemu-utils
Now, navigate to the directory having the virtual disk images
To convert the VHD to VMDK, you need to run the following command:
qemu-img convert /media/user1/data/WinServer2016.vhdx -O vmdk /media/user1/data/WinServer2016qemu.vmdk -p
-O – define the output file format
-p – show the progress bar
Wait until the conversion process is finished.
Download the qemu-img on your system and install it.
After finishing the installation of qemu-img on your computer, run CMD as administrator and navigate to the location where you just installed qemu-img.
The method to convert VHD to VMDK in Windows using qemu-img is the same. You need to use the same commands as used in Linux.
Once you have converted VHD to VMDK, you’d be able to covert Hyper-V to VMware virtual machines as well. Once you have converted, you can import them to your new VMware Virtual Machine to complete the conversion. You can use this method for Virtual Machines running on both Workstation and ESXi.
If you want to find out the method to convert Hyper-V to VMware, follow the instructions given in the next sections.
Assuming you need to make a virtual machine utilizing a converted disk from the VHD to VMDK Workstation, simply make another VM and select that you want to utilize a current virtual disk.
For instance, if you want to set up a new VM in VMware Workstation. Hit File > New virtual machine.
Here, we are going to specifically focus on the steps to import a converted VHD disk to the VMware Workstation Virtual Machine. So make sure to pay attention to the following steps:
Going through the process, you may come across a dialog window that would suggest you that you may convert an existing virtual disk to another format. Whether or not you want to convert, the choice is yours. If you don’t have an older version of Virtual Machine, you should convert the format so it can be used on a newer version of Virtual Machine. You may not be able to use a newer format on an older version of Virtual Machine.
If you have a source Hyper-V Virtual Machine configured to use BIOS, then make sure to choose BIOS as your firmware type in VM options. If you don’t do so, the VMware Virtual Machine to which you have attached a virtual disk converted from the Hyper-V format to the VMware format will not boot.
To find out this setting and check the option, you need to go to VM > Settings and then select the Options tab > Advanced.
Once you have completed the above steps, you should get your Virtual Machine boot correctly. After its successful boot, you can now install the VMware tools.
You can likewise change VHD over to VMDK and import the converted virtual disk to an ESXi-hosted workstation. However, whatever is the format for Workstation and ESXi is a whole different scenario and matter. The difference between virtual disks is that the Workstation disk has a single VMDK file built-in descriptor while the ESXi’s virtual disk has two separate files. The virtual disk on ESXi Workstation has two files where one is a disk descriptor file and the other is a data file. If you have used any of the above two methods to convert the Hyper-V format for an ESXi-hosted virtual machine, you will be required to convert that virtual disk from the Workstation format to the ESXi format. If you don’t convert it to the ESXi format, you may come across the “Unsupported or invalid disk type 2” error.
In case you want to change Hyper-V VMware on VM level, it can be converted from VHD to VMDK and afterward connect a converted VMDK virtual disk to another newly created Virtual Machine. Qemu-img can be utilized as a VHD to VMDK converter with some other similar options available as well. You can use this method without spending anything other than your time and little effort. The methods permit you to change Hyper-V VHD over to VMware VMDK.
If you are converting your virtual machine from one host to another, you may need to convert from one virtual disk format to another. If you are currently on VHD and want to convert to VMDK, the above methods can be used to accomplish this task.
We hope that you find these methods useful and can also be able to create a new VMware Virtual Machine using the converted disk.
If you come across any difficulty or face errors that are not addressed here, it’s recommended to consult a professional technician or an expert.
To run VMDK, you need to have VMware from VMware.
You can either use Hyper-V Manager or PowerShell to convert VHD to VHDX. Before you convert VHD to VHDX, make sure you have the compatible Hyper-V that supports VHDX.
When you use VMware products, the format used is VMDK. On the other hand, when you use Microsoft products, the file format is VMDK. Both formats can be converted into each other.