7-Zip seems unable to compress zero-filled virtual disk image after 1.8 GB

7-zipcompressiondisk-image

I am trying to compress a virtual disk image that is mostly empty. It has about 2 GB used out of 13.5, but even after zero filling the empty space, I am still only able to compress it to around 11.9 GB.

I have been using 7-Zip and tested LZMA, LZMA2, and PPMd at a variety of dictionary sizes and word sizes.

Every time, no matter the settings, after 1.8 GB have been processed, the compression seems to stop. The compression ratio rises from 3% where it was from about the start up to the final 85%.

I know that it should be able to compress further as a previous person compressed an older 17 GB image to 1.5 GB, but they are no longer around for me to ask. The only difference is that this new image has seven partitions instead of the two in the old image.

Is there something I am missing that makes compression of virtual disk images better?

Best Answer

Ok wow, I found the issue. In the process of adding security measures (like separating /tmp /var and others into their own partitions) I also added encryption to each partition. Naturally, seemingly random data after encryption will not compress well at all.