I have a Windows Sever 2012 Standard 64-bit running Hyper-V. The Hyper-V is hosting a guest OS of Windows 7 Professional 32-bit. I noticed that I was running out of disk space on my server. So I uninstalled a bunch of unneeded software. I rebooted the guest machine, and the server. After that I powered off the guest machine and I compacted the virtual disk drive that the Windows 7 system uses.

Even though I have removed 16 GB from the guest system, the used space on the physical server hard disk, is still showing that there hasn't been any change to the size of the virtual disk on the physical sever.

Windows 7

Windows Server

Can some please tell me how I can reduce the size of my virtual disk on my physical servers hard disk?

I have also made a video here that describes my issues, with the updated answers and comments from the users here.

  • Did you run a defrag before compacting the disk? – Rex Apr 9 '14 at 17:01
  • Maybe empty space isn't really empty space, just no longer allocated? I wonder if you have to do a zero-fill on hyper-v. – Zoredache Apr 10 '14 at 0:13
  • @Zoredache Can you please be a little more descriptive? – nate Apr 11 '14 at 16:21
  • @Rex I ran defrag, and tried to compact and shrink again. nothing has changed. – nate Apr 11 '14 at 16:22
  • I mean if you delete a file, the blocks on the hard disk still contain the contents of the file. A deletion only changes the the filesystem metadata. For zero fill see: serverfault.com/questions/165070/… – Zoredache Apr 11 '14 at 18:55

Convert the disk type to a "dynamically expanding" disk. (The more common term, which comes from the VMware world, is thin-provisioned disk). Looks like there's a walk through with screenshots on this Technet blog.

And, of course, as a best practice, this is why you have a separate system partition on your servers, and just use it for the operating system (and maybe an app or two), but store your data (in this case, guest VHDs) on a different partition.

  • Thank you for you response. I will convert them to dynamic, and see if that fixes the issue. I used the fix size so I could stop them going over 120 GB of space. Maybe what wasn't the best course of action. – nate Apr 9 '14 at 16:55
  • Given that his vhdx file is showing as 80GB and the drive on the guest is showing a total capacity of 120GB, I would assume he is already using a dynamic/thin provision disk.. – Rex Apr 9 '14 at 16:56
  • I tried converting the disk to dynamic, I also converted from .vhd to .vhdx now the size on the disk is bigger by 270 MB – nate Apr 9 '14 at 19:05
  • @nate Did you try compacting the disk as well? – HopelessN00b Apr 9 '14 at 19:10
  • I didn't. I am doing that now – nate Apr 9 '14 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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