I'd like to create a squashfs image of a directory, but it's a huge one and even minimal compression would be a big win. Is there a way to do something like mksquashfs -1?

2 Answers 2


Yes. Probably best is:

mksquashfs s o u r c e s outfile -comp lz4

...which I find typically manages output volumes something like 10% to 20% larger than the default gzip compressor, but also does so at least twice as fast and the online file access is also much faster still. Vanilla Linux kernels versions 3.18 and up support lz4 compression and so these archives can be mounted with up-to-date kernels.

You can also add the -Xhc option which will get much closer to a typical gzip archive's size in something like the same amount of time to compress, but the access time remains far faster online.


Apparently an old version of squashfs-tools doesn't have this, but the switch is -Xcompression-level. One can locally build working squashfs-tools with no root rights.

  • 1
    I down voted this at first because it isn't really on the money. It does work, but only w/ the default gzip or the alternative lzo compressors. It does not work w/ lz4 or xz compressors - and there really isn't a good reason to use any but these latter two with up-to-date kernels anyway. Still, it does work by default so I reneged and upvoted you.
    – mikeserv
    Jan 22, 2016 at 5:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .