Published by


Harrylowt's Avatar
Member
Join Date: Feb 2014
Location: UK
Posts: 333

How to Convert Hyper-V Virtual Hard Disk to VHD or VHDX

information   Information
This tutorial will show you how to convert a Hyper-V virtual hard disk toVHD or VHDX in Windows 8and 8.1.

Note   Note
This example will show you how convert a Hyper-V VHD to VHDX, although you are able to also convert VHDX to VHD. Also through out this processes you will see how to change the disk to dynamic or fixed. The VHD/VHDX must not be in use at the time of Convert or you will receive an error.





Hyper-V  Virtual Hard Disk - Convert to VHD or VHDX OPTION ONE Hyper-V  Virtual Hard Disk - Convert to VHD or VHDX
Convert Hyper-V Virtual Hard Disk to VHD or VHDX in Hyper-V

1. Press the + R keys to open the Run dialog, type virtmgmt.msc, and click/tap on OK.

Click image for larger version

2. In the left pane, right click or press and hold on your Hyper-V Server (ex: GBPNB00694), and click/tap on Edit Disk.
NOTE: Alternatively, you could also click/tap on Edit Disk under Actions in the far right pane.

Click image for larger version

3. Click/tap on Next on the Before You Begin page.

Click image for larger version

4. To navigate to your Virtual Hard Disk, and click/tap on Browse.

warning   Warning
Do not edit a virtual disk associated with a virtual machine that has snapshots, has replication enabled, or associated with a chain of differencing virtual hard disks. Otherwise, data loss is likely to occur

Click image for larger version

5. Click/tap on the Virtual Hard Disk you want to convert, click/tap Open, and click/tap on Next on the Locate Disk page.

Click image for larger version

6. On the actions page, choose Convert, and click/tap on Next.

Click image for larger version

7. On the Choose Disk Format page, choose what disk format (ex: VHDX) you are converting to, and click/tap on Next.

Click image for larger version

8. On the Choose Disk type Page, choose what disk type (ex: Dynamic expanding) you desire from your Virtual Hard Disk, and click/tap on Next.

Click image for larger version

9. On the Configure Disk Page, choose a save location and the Virtual hard Disks file name (ex: Eightfourmsconvert) at the end of my default file path, and click/tap on Next.

Click image for larger version

10. On the Summary page, click/tap on Finish.

Click image for larger version

11. The Virtual Hard Disk will now convert.

Click image for larger version





Hyper-V  Virtual Hard Disk - Convert to VHD or VHDX OPTION TWO Hyper-V  Virtual Hard Disk - Convert to VHD or VHDX
Convert Hyper-V Virtual Hard Disk to VHD or VHDX in PowerShell

1. Open an elevated PowerShell.

2. From your PowerShell console you can use a code like below to convert a virtual hard disk.

  • You will see firstly you use Convert-VHD cmdlet, where you then use -path to specify where your Virtual Hard Disk is located. That will be the disk you want to convert.
  • The next step is to choose a destination for the output of the Virtual Hard Disk. To do this we use the -Destinationpath switch followed by the output path and file extension.
  • To make the virtual hard disk type dynamic, use the switch -VHDType Dynamic. To make the virtual hard disk type fixed, use the switch -VHDType Fixed.


Code:
Convert-VHD –Path 'C:\Users\Public\Documents\Hyper-V\Virtual hard disks\eightforum.vhd' –DestinationPath 'C:\Users\Public\Documents\Hyper-V\Virtual hard disks\eightforum.com.vhdx' -VHDType Dynamic
Click image for larger version