My daily task requires me to do research on certain new things, different platform, testing software, or running multiple version of IDE (eg. Visual Studio). One crazy idea is to install my IDE inside VM and do all my research inside VM so the host machine will still in it’s peak performance due to less install garbage.
But now we’re not going to talk about the VM it self (it might be used as another topic another day), due to the availability of Hyper-V virtualization when you purchase Windows workstation license since Windows 8 made me want to migrate all my VM from VMWare Workstation to Hyper-V. Here’s how i make it happen
What you need first is to convert vmdk file to vhd / vhdx, tools that we will need:
- Microsoft Virtual Machine Converter (MVMC), unfortunately when this article is published, the software is no longer available to download via Microsoft. Since I’m still using it and still comfortable with it so this article will still be published. Alternate solution is using Starwind’s V2V Converter which is also a free software (will talk about this in another article; maybe)
- dsfok a tools to extract and pack descriptor file which maybe we will need it later
Assuming MVMC is already installed, this is how we convert vmdk to vhd / vhdx
- Open elevated command prompt (cmd) / power shell (ps)
- Run
Import-Module "[MVMCInstallDir]\MvmcCmdlet.psd1"
assuming it’s in it’s default installation folder so the command will beImport-Module "c:\Program Files\Microsoft Virtual Machine Converter\MvmcCmdlet.psd1"
- Run
ConvertTo-MvmcVirtualHardDisk -SourceLiteralPath [sourcePath] -DestinationLiteralPath [destinationPath]" -VhdType FixedHardDisk -VhdFormat Vhd
such asConvertTo-MvmcVirtualHardDisk -SourceLiteralPath "d:\VMWare\Windows Server 2012 R2 x64\Windows Server 2012 R2 x64-single.vmdk" -DestinationLiteralPath "d:\Hyper-V\Windows Server 2012 R2 x64\Windows Server 2012 R2 x64.vhd" -VhdType FixedHardDisk -VhdFormat Vhd
.
For dynamic disk -VhdType and -VhdFormat should configured as DynamicHardDisk and vhdx respectively, while for fixed disk, configure it as FixedHardDisk and vhd respectively - If you encounter error(s) when running conversion:
- ConvertTo-MvmcVirtualHardDisk : The entry 1 is not a supported disk database entry for the descriptor. At line: 1 char: 1
We will need dsfok to fix this, extract dsfok and navigate your cmd or ps to dsfok folder and do the following:- Extract vmdk descriptor
.\dsfo.exe "d:\VMWare\Windows Server 2012 R2 x64\Windows Server 2012 R2 x64-single.vmdk" 512 1024 descriptor.txt
- Open descriptor.txt inside your dsfok folder and you will see there’s a config part named ddb.toolsInstallType = “1”, we need to either comment or delete this part. To comment we can append hash (#) in front of the config line so it would look like
#ddb.toolsInstallType = "1"
- Repack edited descriptor back to vmdk
.\dsfi.exe "d:\VMWare\Windows Server 2012 R2 x64\Windows Server 2012 R2 x64-single.vmdk" 512 1024 descriptor.txt
- Retry step 3 above
- Extract vmdk descriptor
- ConvertTo-MvmcVirtualHardDisk : The entry 1 is not a supported disk database entry for the descriptor. At line: 1 char: 1
- There should be a custom like progress bar indicating the process state
Upon success a summary will shown - Next we will boot up converted OS to Hyper-V
Create new virtual machine using converted disk in Hyper-V (New > Virtual Machine)
Finish and try to boot up your Hyper-V virtual machine and voila
Hope these helps. cheers 🙂