Compact VHD using Virtual PC / Virtual Server / Hyper-V or Windows 7

If you want to compact a virtual hard disk, you can use Virtual PC / Virtual Server / Hyper-V or Windows 7. But not all methods are same. Under covers there’re two different approaches that’re taken to compacting virtual hard disks: “Hyper-V and Windows 7 use a different approach to compacting virtual hard disks. What […]

If you want to compact a virtual hard disk, you can use Virtual PC / Virtual Server / Hyper-V or Windows 7. But not all methods are same. Under covers there’re two different approaches that’re taken to compacting virtual hard disks: “Hyper-V and Windows 7 use a different approach to compacting virtual hard disks. What they do is look for an NTFS file system on vhd. If they find one, they read this data directly and use it to identify zeroed blocks that can be removed from vhd. This operation is done “in place” which means that no second vhd is created. Advantages: No preparation needed - just point it at an offline virtual hard disk and it works; No need for extra free space on the physical disk; Faster than Virtual PC / Virtual Server. Disadvantages: Does not work with non-NTFS formatted virtual hard disks.”

More info: Virtual PC