[VPC] Compressing VHD files
As mentioned some time ago, we're shuttling VHD files around the office to share preconfigured developer environments. Even precompacted, VHD files are still pretty huge - 5 to 10 GB. They can compress down quite a bit, though - as much as 70% or so.
The built in "compressed file" support in Windows can choke on files this size. I've been using 7-zip, a free compression program, to shrink mine. It includes support for ZIP, but self-extracting SFX's can cut a few hundred more MB's off the file size. That can save several minutes on a network file copy, or make the difference between whether the file will fit on a DVD. For example:
VHD - 5.4GB
Zipped VHD - 2.1GB (38%)
SFX VHD - 1.7GB (31%)
Here are some batch files which I'm using to compress the images. They use the command line version of 7-Zip. I'm sure these batch files can be improved, or I could add a right click option to VHD files or something - I'm open to suggestions. The main thing I wanted to share, though, is the command line settings for max compression SFX and ZIP compression:
SFX (Self Extracting EXE):
d:\
cd "d:\virtual machines\VS2005\"
c:\Utils\File\7zip\7za.exe a -sfx -mx=9 VS2005Beta2.exe VS2005Beta2.vhd
Zip:
d:\
cd "d:\virtual machines\VS2005\"
c:\Utils\File\7zip\7za.exe a -tzip VS2005.zip VS2005.vhd -mx=9