You ask yourself – why would you do this, who is this tutorial for? VHDX is after all newer hard disk format with many benefits.
I need this command quite often, since Azure is limited to .vhd files and my template library for local lab deployment is mostly vhdx (gen 2 virtual machines).
Here is a quick trick to convert .vhdx to .vhd. You can do it by selecting one of the two methods below.
Open Powershell with elevated privileges (as admin) and type in following command:
Convert-VHD –Path c:\temp\Vmdisk.vhdx –DestinationPath c:\temp\VMDIskNEW.vhd
Here is how it looks like in real life
And soon enough, it is done
VHDX is converted to VHD
There is also another (easier for some) method of doing this vhdx to vhd conversion.
Again, I have a vhdx disk that I want to convert, copied to c:\temp folder.
I will then open Hyper-V Manager. I created simple empty VM (Generation 2), to which I will then attach this VHDX.
Select VM (it can also be your regular VM, just be careful with handling disks) and select Settings from the right window
After Settings are opened, click on SCSI Controller, Hard Drive – Add
New Hard Drive will appear under SCSI Controller and it will be empty, select Browse and point to VHDX drive you want to convert from VHDX to VHD. Path to your VHDX should be then visible in the field.
Ok, now that the vhdx we wish to convert is attached to our temporary VM, we will select Edit button (we are still in Settings area under Storage Controller).
New Wizard will appear, before start – make sure you selected right vhdx disk, you really want to convert. It would be extremely wise not to do this procedure on your production VM machine.
We will select Convert action | Next
Select VHD | Next
If you are going to use this machine in Azure, you will select Fixed size. Otherwise select what you see fit.
You will then have to select location and the name for converted vhd. I selected as depicted below. Next
Check your settings and select Finish. Conversion process will then start.
You can now Remove VHDX you attached for the conversion, from your VM.
With this step we are concluding this tutorial, in which I showed two methods for converting VHDX to VHD.