Is compacting a Hyper V virtual machine VHD file a safe operation

hyper-vvhd

Is compacting a Hyper V VHD (Server 2008 R2 Host) a safe operation? I compacted a Server 2008 Std 64 Bit virtual machine's boot volume and it ended up being about 500 Mb smaller. The VM was shut down at the time. However over the next 10 days that machine seemed to lock up in very strange way approximately every 2 days but not a consistent time.

It would stop responding to the network, but it was sometimes possible to get in on the console directly on the Hyper V host. If the console was locked it would not respond to ctrl-alt-delete but the easy access button would hilight and unhilight with a mouse-over. And it could be clicked and the window opened but would not respond to anything else. On one occasion the console was not locked and the start menu could be used, and the right-click menu for icons would pop-up. However there was no response to starting an application, or clicking on menus. It also would not shut-down even from the the Hyper-V manager and had to be powered off and on. After a power off and on it worked normally sometimes for a few days.

There are no useful messages in the Windows errors logs – aside from unexpected shutdown errors. A check disk reported no errors, and aside from the hanging the machine behaved normally.

I have reverted to a copy of the VHD taken before the compact and so far it has not hung (in 3 days).

I want to think this wasn't due to the compact process, however the timing is very suspicious and now I am very wary of using compact. However, I have not been able to find anyone else reporting a problem with it.

And yes this is a relatively unimportant production server, I know most people recommend fixed size VHD for production, but I want to minimize disk usage and don't mind a slight performance penalty.

Best Answer

I know its not going to answer your problem, but I have a few VMWare images that get compacted reasonably regularly, and I've never had the problem you describe.

I'd try again and see if you get the same errors, it's possible it was a 'glitch' (but I guess that still doesn't help if you can't trust the operation any more)