2

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.

nate
  • 407
  • 5
  • 7
  • 17
  • Did you run a defrag before compacting the disk? – Rex Apr 09 '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 00: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: http://serverfault.com/questions/165070/how-to-zero-fill-a-virtual-disks-free-space-on-windows-for-better-compression – Zoredache Apr 11 '14 at 18:55
  • @Zoredache I downloaded sdelete and run it on my c drive with the switches of z and c. It cleaned 3 GB from my drive, but I gained 200 MB on the server hard disc. – nate Apr 12 '14 at 15:50

1 Answers1

1

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.

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
  • 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 09 '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 09 '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 09 '14 at 19:05
  • @nate Did you try compacting the disk as well? – HopelessN00b Apr 09 '14 at 19:10
  • I didn't. I am doing that now – nate Apr 09 '14 at 19:14
  • I edited the disk and ran compact, it didn't do anything. I have to new option to shrink now. Do you think that is what I am looking for, since the VM is dynamic now? – nate Apr 09 '14 at 19:18
  • @nate Yup, sure sounds like it. – HopelessN00b Apr 09 '14 at 19:30
  • That did the same as compacting, which was nothing. I mounted the drive on my sever, and then ran shrink. The VM now shows 20 GB used out of 80 GB. But the size on the server hard disk still shows the same – nate Apr 09 '14 at 20:19
  • @nate, well, I'm fresh out of ideas, then. – HopelessN00b Apr 09 '14 at 20:20