SquashFS
SquashFS is a compressed read-only filesystem built into the Linux kernel. It's the format behind live CDs, Ubuntu's .snap packages, OpenWRT firmware, compressed initramfs images, and most "ship a filesystem tree as a single file" use cases. flatroot supports it as an export target for exactly that reason — SquashFS output works anywhere a mainline Linux kernel can mount, which is almost everywhere.
What SquashFS gives you
- Built-in kernel support — no FUSE driver, no external tool at mount time.
mount -t squashfs image.sqfs /mntworks on any modern kernel. - Multiple compression backends — gzip, lzo, xz, lz4, zstd.
mksquashfspicks based on command-line flags. - Block-level random access — individual files can be read without decompressing the whole image.
Compression ratio is competitive with tar.xz and better than tar.gz, though typically lower than DwarFS on rootfs-shaped inputs.
External-tool requirement
Building a SquashFS image requires mksquashfs (part of the squashfs-tools package on most distros). flatroot shells out — it does not re-implement the format. At mount time, the kernel's built-in driver handles everything; no userspace tooling is needed.
How flatroot uses it
flatroot invokes:
Flags explained:
-noappend— forces a clean write. Without it,mksquashfsappends to an existing image rather than overwriting it, silently merging stale contents into the new archive; the flag exists to prevent that.-e .flatroot— excludes the.flatroot/metadata directory.-epaths are source-relative, so this matches only<rootfs>/.flatrootand leaves any user directories named.flatrootelsewhere in the tree untouched. See Export exclusion for the invariant.
Resulting images mount with:
When to choose SquashFS over DwarFS
- Use SquashFS when portability matters — the target system just needs a Linux kernel, no extra packages.
- Use DwarFS when archive size matters more than consumer-side simplicity.
Further reading
- SquashFS — kernel docs
- squashfs-tools project
- CLI reference — export
- DwarFS — the compression-first alternative.
Related pages
- Appendix / Formats / DwarFS — DwarFS — Deduplicating Warp-speed Advanced Read-only File System — is a compressed read-only filesystem optimized for extreme compression while preserving fast random access....
appendix formats export - Appendix / Formats / OCI image format — The OCI image format is the standard packaging format for container images, maintained by the Open Container Initiative. It's the format docker load and podman load consume,...
appendix formats export - Appendix / Formats / ar (Unix archive) — ar is one of the oldest Unix archive formats — originally used to pack object files into static libraries (libfoo.a). It is not a compression format: it just concatenates...
appendix formats