Documentation/filesystems/squashfs.rst

Source file repositories/reference/linux-study-clean/Documentation/filesystems/squashfs.rst

File Facts

System
Linux kernel
Corpus path
Documentation/filesystems/squashfs.rst
Extension
.rst
Size
14166 bytes
Lines
324
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

=======================
Squashfs 4.0 Filesystem
=======================

Squashfs is a compressed read-only filesystem for Linux.

It uses zlib, lz4, lzo, xz or zstd compression to compress files, inodes and
directories.  Inodes in the system are very small and all blocks are packed to
minimise data overhead. Block sizes greater than 4K are supported up to a
maximum of 1Mbytes (default block size 128K).

Squashfs is intended for general read-only filesystem use, for archival
use (i.e. in cases where a .tar.gz file may be used), and in constrained
block device/memory systems (e.g. embedded systems) where low overhead is
needed.

Mailing list (kernel code): linux-fsdevel@vger.kernel.org
Web site: github.com/plougher/squashfs-tools

1. Filesystem Features
----------------------

Squashfs filesystem features versus Cramfs:

============================== 	=========		==========
				Squashfs		Cramfs
============================== 	=========		==========
Max filesystem size		2^64			256 MiB
Max file size			~ 2 TiB			16 MiB
Max files			unlimited		unlimited
Max directories			unlimited		unlimited
Max entries per directory	unlimited		unlimited
Max block size			1 MiB			4 KiB
Metadata compression		yes			no
Directory indexes		yes			no
Sparse file support		yes			no
Tail-end packing (fragments)	yes			no
Exportable (NFS etc.)		yes			no
Hard link support		yes			no
"." and ".." in readdir		yes			no
Real inode numbers		yes			no
32-bit uids/gids		yes			no
File creation time		yes			no
Xattr support			yes			no
ACL support			no			no
============================== 	=========		==========

Squashfs compresses data, inodes and directories.  In addition, inode and
directory data are highly compacted, and packed on byte boundaries.  Each
compressed inode is on average 8 bytes in length (the exact length varies on
file type, i.e. regular file, directory, symbolic link, and block/char device
inodes have different sizes).

2. Using Squashfs
-----------------

As squashfs is a read-only filesystem, the mksquashfs program must be used to
create populated squashfs filesystems.  This and other squashfs utilities
are very likely packaged by your linux distribution (called squashfs-tools).
The source code can be obtained from github.com/plougher/squashfs-tools.
Usage instructions can also be obtained from this site.

2.1 Mount options
-----------------
===================    =========================================================
errors=%s              Specify whether squashfs errors trigger a kernel panic
                       or not

Annotation

Implementation Notes