make your squashfs filesystems smaller
using lzma compression algorithm

Useful links



SquashFS version 4 is included in Linux Kernel since 2.6.29 and it supports XZ (LZMA2) compression since 2.6.38. What does it mean for this project (squashfs-lzma.org)? There is no longer any need to use external patches, so this project is discontinued. You can happily mount your newly created squashfs images directly with recent kernel! :) This website will remain with slight updates for reference.

Why Squashfs LZMA?

LZMA is one of the best compression algorithms and Squashfs is one of the best compressed filesystems available nowadays. This project combined both to make something even better. LZMA can compress much better then gzip, which was the only option in squashfs for years. Compressing to LZMA format is very slow, but this is not a problem as the squashfs filesystem needs to be compressed only once. Then it's only read million times; so what we care about is the speed of decompression. LZMA decompression is slower than gzip, but it's even very fast, about 10-20 MB/s on a 2GHz CPU.

Compression benchmarks

method block size Slax data size percent
uncompressed - 668 MB 100%
mksquashfs+gzip 64KB 227 MB 34%
mksquashfs+gzip 1024KB 222 MB 33%
mksquashfs+lzma 64KB 191 MB 28%
mksquashfs+lzma 128KB 184 MB 27%
mksquashfs+lzma 512KB 172 MB 26%
mksquashfs+lzma 1024KB 167 MB 25%

Why the patches existed?

Squashfs' author couldn't support LZMA directly in squashfs source code. He wanted to have the squashfs code included in official Linux Kernel, but Linux Kernel didn't support LZMA/XZ at that time, so adding LZMA to squashfs would decrease the chance for its (squashfs's) inclusion. This was the main reason we had to maintain LZMA support as a separate patch.

How to build squashfs with LZMA support now?

As already said, recent squashfs doesn't need any patches neither to kernel nor to the tools. Simply download squashfs tools v4.x from the link at the top left sidebar, extract, edit Makefile to add XZ support by uncommenting XZ_SUPPORT = 1, and run make && make install. Then you can compress your files using for example:

mksquashfs source1 dest.sqfs -comp xz -b 262144
squashfs4.3 Download
squashfs4.2 Download
squashfs4.1 Download
squashfs4.0 Download
squashfs3.4 Download
squashfs3.0 Download
squashfs2.2 Download
squashfs1.3 Download