Why run de-frag before compacting a virtual disk?
As explained in the article on vhd pre-compactor, the pre-compactor zero’s out the unused blocks. The compactor can then collapse some of these blocks. Ideally if all the zero filled blocks are at the end of virtual image file, then the file can just be truncated. This is essentially what de-fragmentation does. It takes all the free blocks and moves them to the end of the disk as it tries to make all the blocks for the files on the disk to be contiguous.