Best compression for Virtualbox vdi
I've tested a lot of compressors with many different options: PAQ, ZPAQ, LX, LRZIP, NZ, 7Z
The absolute best is the nz (nanozip) compressor, especially if not only the speed is an important factor. Unfortunately is a dead project and the guy who made it is probably confined in Area 51, because it is undoubtely eons ahead to any other compressor.
LRZIP is another good choice but is really it worthy?
General test - 1.6GB vdi
nz -co --> 523M 7z -mx=9 -md=512 --> 474M nz -cO --> 472M lrzip -L9 -z --> 453M
it seems OK, just like paq8, but unfortunately with the high compression options it takes ages. it's almost ridiculous.
So, I should use NanoZip (nz), but I prefer something more renown and supported (important for backups). For this reason I concentrated my latest tests on 7z looking for a config that could be comparable with nz.
7Z test - vdi 1.9 GB Just to have a basis for comparison:
simply mx5: 4'.49" 552MB simply mx9: 6'.19" 536MB
Now the test.
**mx-mfb-md min.sec MB** - -256 5.58 500.9 5-64-256 6.57 499 7-32-256 6.02 501 7-64-128 6.59 524.2 7-256-16 9.04 550 9-16-512 5.49 484.4 7-16-512 5.49 484.4 5-16-512 5.42 484.4 <== 1st choice speed/compression 3-16-512 3.44 518.5 <== 3rd choice ++speed/--compression 5-8-512 4.31 502.6 <== 2nd choice +speed/-compression 5-32-512 10.37 479.2 3-32-512 4.04 515.8
So the options matter a lot, and the three choices hilighted seem quite great without the need of exotic compressors.
This test hilight that
-md is the most important for huge files, but it's also the option that eat RAM. On this test it stole 6GB. If you don't have such kind of RAM, decrease the value so to avoid the swapping that would paralize your computer.
-mfb can improve compressione but heavily influence the time required.
The winner to me is then:
7z a -t7z -m0=lzma -mx=5 -mfb=16 -md=512m -ms=on xxx.vdi.7z xxx.vdi
for great compression along with a decent time. lrzip/paq8 takes 5 times more time for basically the same result.
PS: Do not attempt such command line with lzma2 unless you have 30 or more GB of RAM and you don't care about CPU temperature. And by the way lzma2 has no better compression than lzma.
Double check
Some tests repeated with a bigger vdi: 7GB
7z a -t7z -m0=lzma -mx=5 -mfb=16 -md=512m -ms=on 23m50.483s 2.763.075.479 bytes 7z a -t7z -m0=lzma -mx=5 -mfb=256 -md=256m -ms=on 41m1.257s 2.799.416.149 bytes 7z a -t7z -m0=lzma -mx=7 -mfb=256 -md=128m -ms=on 37m40.608s 2.889.396.891 bytes 7z a -t7z -m0=lzma -mx=3 -mfb=256 -md=256m -ms=on 31m47.489s 2.912.367.216 bytes 7z a -t7z -m0=lzma2 -mx=9 -ms=on 10m33.063s 2.951.890.991 bytes 7z a -t7z -m0=lzma -mx=7 -mfb=273 -ms=on 35m23.239s 3.024.975.250 bytes
About -ms (solid archive): can be on or off, doesn't matter with vdi as it is only 1 file. It does count only when there are many files.