joefitzgerald/packer-windows — pull request #53 by jdub (2014-05-04 01:59:36+00:00)
Title: Use ultradefrag and sdelete to reduce the size of generated boxes

compact.bat uses the Open Source ultradefrag tool to optimise layout of files on disk, and the Sysinternals sdelete tool to zero free space. This results in a worthwhile reduction of box size for a small cost of time during image build.

Windows 2008 R2 Core without compact.bat: 3.15GB
Windows 2008 R2 Core with compact.bat: 2.66GB

-a--- 4/05/2014 1:12 AM 2861625665 windows_2008_r2_core_virtualbox.box
-a--- 4/05/2014 11:34 AM 3392925331 windows_2008_r2_core_virtualbox_without_defrag.box

I have only tested it with Windows 2008 R2 images (both core and standard), so have only proposed it for inclusion by default in their configuration files. I'll try 2012 next.

Note that compact.bat currently uses the amd64 version of ultradefrag. I'll probably update this PR to switch between 32 and 64 bit versions. sdelete is 32 bit.