Greg Carnie

Greg Carnie

Unable to Compact a VHD Due to a File System Limitation

While trying to compact a vhd that had been (unbeknownst to me) generating huge quantities of log files I recently ran across the rather strange "Unable to Compact a VHD Due to a File System Limitation" error:

VHD Compact Error

I found a couple things to try thanks to Google:

  • vssadmin delete shadows /all
  • KB982210: The startup time increases or hangs at the logon “Welcome” screen if you frequently backup Hyper-V virtual machines on a Windows Server 2008 R2 system

But none of those worked.  After a fair amount of digging on the net and around my VM I concluded that I had a grand total of 1280MB in VSS copies stored in my VHD itself.  Then I found The Angry Technician: Vssadmin is dead, long live Diskshadow! Perfect!! Diskshadow is the answer. One simple command to execute, 5 seconds to wait, and everything was good again:

	diskshadow <enter>
	list shadows all <enter> *(if you want to see them all)*
	delete shadows all <enter> *(this was specific to my case, you may want to be selective about which shadows to delete)*