On Windows Server 2008 R2 running Hyper-V, I’m trying to compact a (dynamically expanding) VHD on an external hard drive (USB drive, NTFS format). The drive is 59GB and there is 103GB free on the drive. I keep getting the message, "The system failed to compact <MyDrive>.VHD. Error code: The requested operation could not be completed due to a file system limitation." Why can’t I compress the VHD?
In the Hyper-V-Image-Management-Service Admin log, we have Event ID 15054:
Log Name: Microsoft-Windows-Hyper-V-Image-Management-Service-Admin
Event ID: 15054
Description: ‘The system failed to compact ‘F:\<MyDrive>.VHD’. Error Code: 2424869
I thought maybe the physical drive was too fragmented, but a defrag ran quickly and made no difference.
This blog post provides the answer: the VHD contains VSS shadow copies. (It’s a Server 2003 with Volume Shadow Copies enabled.)
Start up the virtual machine and log on to the guest. Run vssadmin list shadows to check for shadow copies. Run vssadmin delete shadows /all to delete the shadow copies. Then shut down the virtual machine guest and try compacting again.