Compacting Virtual Hard Disks in Windows 8 / Windows Server 2012

Rate This
  • Comments 7

Recently the “Ask the Core Team” blog did a great post about compacting a dynamically expanding virtual hard disk in Windows 8 / Windows Server 2012.  You should check out their full post for the details, but the summary is that you now need to manually mount the virtual hard disks in the management operating system prior to trying to compact it.

This is something that we used to do automatically for you – but we had reports of problems when we were attaching and removing virtual hard disks when the system administrator was not expecting it – so we have changed this to a more manual process.


Leave a Comment
  • Please add 2 and 8 and type the answer here:
  • Post
  • Hi

    What is the difference between PowerShell Optimize-VHD and Diskpart compact vdisk ?


  • I have a windows 8 installed in my computer and I am not able to install a virtual machine on it.  I have no clue how to do it. I've already tried to download virtual PC 2007 and I did't work at all, Can anybody help me, please?

    Thanks a lot!

  • Daniella,

               have you enabled the HyperV role on the Windows 8 pc?



  • Thank you for the link. I'm not seeing this documented anywhere in the technet library in the server 2012 -> hyper-v role section. Is this documented anywhere officially? The Server 2008 R2 -> Hyper-V documentation has a section on the edit disk wizard and what the different options do as expected. In Server 2012, as you point out, choosing the option "Compact" does nothing which is not expected and needs to be noted.

  • So... you're telling me I have to click and type and attach and detach something that I just used to right click and compact. Horse Poop. What a waste of administrator time.

  • This makes no sense. Just warn the user prior to doing it? Currently the "Compact" command just silently does nothing. Do you realise how much time everyone wastes to google for this?

  • I have to agree, this is non-intuitive.   I've just gone through the same process of trying to work out why the operation appears to be successful, leaves no errors in the logs, and yet..... does nothing that you'd expect.

    At the very least, I would expect the wizard to notify you of any pre-work that needs to be performed to enable the process to have an impact or to throw an error when the pre-work hasn't been done.

Page 1 of 1 (7 items)

Compacting Virtual Hard Disks in Windows 8 / Windows Server 2012