1

I have a dynamically expanding .vhd file. The current file size was about 50 GB, with only 29 GB used. However, it recently expanded to about 54 GB, but still only shows 29 GB used.

Are there any reasons that a .vhd file would expand when it still has plenty of unused space?

Nathan
  • 276
  • 1
  • 5
  • 13

2 Answers2

2

The .vhd file tracks changes to an assumed blank disk.

Just because some areas of the filesystem aren't used, doesn't mean that they don't have shadow copies or leftovers from previously used files.

This is, for example, how un-delete programs work.

To clarify:

The "unused" space on your disk may not be blank.

John Gietzen
  • 448
  • 5
  • 11
  • So if I understand you correctly - this is completely below the windows file system level, and is akin to individual magnetic bits on a physical hard drive. Is there any way to get a report on how much space is unused by the *filesystem* but still taking up space in the .vhd file? – Nathan Nov 24 '09 at 23:30
  • Another question: why wouldn't the Windows file system on the virtual OS simply overwrite the existing bits in the .vhd file like it would on a physical hard drive? – Nathan Nov 24 '09 at 23:38
2

In addition to Johns answer, you can regain space by running the pre-compactor application inside the guest - to zero out any unused space inside the vhd. And then run the shrink/compact on the vhd from your virtualization tool... then you'll know the real usage ^^

The precompactor tool is bundled with most releases of Virtual PC and Virtual Server and can for example be found in:

Program Files\Microsoft Virtual PC\Virtual Machine Additions\

It will work for Hyper-V vhd as well regardless of where you sourced the precompactor iso from.

Oskar Duveborn
  • 10,740
  • 3
  • 32
  • 48