Compact Hyper-V Hard Disk VHDX File in Windows 8

Windows Server 2012 and Windows 8 support Hyper-V 3+, but Hyper-V 3+ changed something such as compact virtual hard disk file no more work if you do not do extra steps: attach virtual hard disk file and detach again.

The following are steps in Windows 8.

1: Try to find Disk Management in Windows 8 and run it:

image

2: Menu Action \ Attach VHD to attach a virtual hard disk file:

(Please make sure this virtual hard disk is NOT in use, so if your virtual machine is running, stop it first)

image

You MUST check on “Read-only”:

image

3: After you attached VHD, you should see new disk in Disk Management:

image

4: Now go back to Hyper-V management to do regular Hyper-V hard disk compact process

image

You should see the following processing screen, otherwise,

image

You can also use PowerShell command to the same compact step:

image

5: After compact, please remember to go back to Disk Management to detach VHD

image

Actually, for my case, the .vhdx file size did not change enough, maybe my .hdvx file is a new generated file, but you can try using above steps for your case.