Creating filesystems with compression
The squashfs
program creates a read-only, heavily compressed filesystem. The squashfs
program can compress 2 to 3 GB of data into a 700 MB file. The Linux LiveCD (or LiveUSB) distributions are built using squashfs
. These CDs make use of a read-only compressed filesystem, which keeps the root filesystem on a compressed file. The compressed file can be loopback-mounted to load a complete Linux environment. When files are required, they are decompressed and loaded into the RAM, run, and the RAM is freed.
The squashfs
program is useful when you need a compressed archive and random access to the files. Completely decompressing a large compressed archive takes a long time. A loopback-mounted archive provides fast file access since only the requested portion of the archive is decompressed.
Getting ready
Mounting a squashfs
filesystem is supported by all modern Linux distributions. However, creating squashfs
files requires squashfs-tools
, which can be installed...