Squashfs
Squashfs is a compressed read only file system. It supports gzip, lzma and lzo compression. It can be used together with aufs to provide a fast writable filesystem for desktop and embedded systems.
Gentoo Linux users can use squashfs+aufs to create a fast root filesystem.[1]
mksquashfs
Filesystems are made using mksquashfs. -b specifies the block size, 131072 (128k) is the default size. Larger block size usually results slightly in better compression, but the read speed will be worse. The default block size is a good choice.
Shell command: |
nice -n 19 mksquashfs /usr /squashed/backup/usr.sfs.`date --iso` -comp xz -b 131072
|
xz is slower when making and compressing the filesystem. xz compresses better and read performance will therefore be better depending on harddrive speed and CPU.
Compression comparison
These are the results of a /usr tree on a very big Gentoo Linux installation with a few games being compressed using gzip and xz.
19090 Mbytes filesystem |
gzip, 128k bs |
gzip, 256k bs |
xz, 128k bs |
xz, 256k bs |
Compressed size |
8992.04 Mbytes |
8955.73 Mbytes |
8384.18 Mbytes |
8247.87 Mbytes |
% of uncompressed filesystem size |
48.23% |
48.04% |
44.97% |
44.24% |
% uncompressed inode table size |
28.59% |
28.54% |
22.32% |
22.17% |
% uncompressed dir size |
36.37% |
36.26% |
33.46% |
33.40% |
The difference between xz and gzip is huge, the difference between 128k and 256k block sizes is not.