How to shrink the size of a virtual machine hard disk

virtual-machines

I have a Virtual machine hard disk over 20GB in size. But there are only about 8-10GB of files inside.

I need to shrink this vhd file to a more manageable (actual) file size.
I've tried using the virtual PC wizard and it doesn't do anything with the file size.

Is there any other solutions or tools that I can use to shrink the vhd file size?

Best Answer

Actually, Microsoft Virtual PC already has an option called "Compact virtual disk". Read about it in the help file. However, to achieve the best reduction you will need to zero-fill the empty parts of the disk. For that you will need a third party tool - but there are plenty of those. Just google.

Sorry, misread your post. You already tried that. In that case you didn't read the help file hard enough. I quote:

Before compacting the disk, we recommend that you use a disk utility to zero out blank space, which should result in a smaller compacted virtual hard disk.

I use a utility called Eraser. I think it was recommended in some Microsoft TechNet posting or MSDN. And it's totally free.