Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using Disk2VHD utility I converted my bare-metal OS into Hyper-V VHD -

And I could obtain a huge 190GB VHD file. Apart from performance issues, this VHD worked fine as guest when hosted on Windows Server 200 R2, Hyper-V.

Having realized need to keeping only system files and application installations on VHD. I have deleted most of the junk data from this VHD and now it contains only 20-25 GB. But I am not able to shrink the VHD VM. Having done some research, I came to know, this as a limitation of .VHD files.

Subsequently I followed these two step using Edit Virtual Hard Wizard on Windows 2012 Box.

  1. Convert from VHD to VHDX (took close to 3 hrs.)
  2. Compact (Another 4 hrs.)

This did not ever shrink the VHDX either. Does Hyper-V does not provide proper support to handle large VHDs or VHDXs whose size are the range of 200GB.

share|improve this question
up vote 1 down vote accepted

Do you really need a 190 GB drive? If you are running 2008 R2 in he guest, then shrink your partition from within the guest, then compact. This will achieve the best results.

  1. Defrag the drive.
  2. Open Disk Management and shrink the partition to something more reasonable, like 40 GB. Make sure all of the free space is at the end of the drive.
  3. Shut down the guest.
  4. Compact the VHD.
share|improve this answer
shrinking the partition seems difficult. System does not go beyond "Windows is querying size to shrink". – Abhijeet Sep 26 '12 at 22:12
this process works for me. i've had to do it dozens of times since i started my current job. the guy before me assigned 500 GB to every VM. – longneck Sep 26 '12 at 22:13

Yeah, always a big pain in Hyper-V. I can only tell you what I do, though I can only think (hope) that there must be a better solution.

1) Capture the full size drive

2) Create a new blank VHD of the size I want the drive to be.

3) On host use Symantec ghost to do a disk-to-disk copy from large to new. This only copies the data.

4) Delete the large VHD

Hope that helps. Not ideal I know.

share|improve this answer

Delete all the VSS snapshots on your VHD, if there are any. Then try the "compact" step again.

share|improve this answer

Have you tried running precompact.exe or similar tool (easiest by mounting the ISO file) on the guest first to zero out the reclaimed space? Then run the VHD compact process after that.

See Compact/Shrink an Expandable/Dynamic VHD to fully recover space

share|improve this answer
thanks. looks interesting will try. – Abhijeet Aug 30 '15 at 7:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.