Skip to content

The Filesystems Inside

Most of a firmware image, once the bootloader and kernel are carved away, is a root filesystem: the device's whole directory tree, packed into one of a handful of filesystem formats chosen for flash memory and small machines. Binwalk recognises all of them. Whether it can unpack one depends on a helper program being installed — binwalk's extraction rules shell out to the format's own tools. Knowing the cast, and which helper each one needs, turns a mysterious half-extraction into an obvious missing package.

Filesystem Where you meet it Helper that unpacks it
SquashFS the default root filesystem of small Linux devices; read-only, compressed unsquashfs; sasquatch for vendor-modified variants
CramFS older devices; SquashFS's simpler ancestor cramfsck / kernel support
JFFS2 raw flash on older routers and embedded boards; a journalling log of nodes, not a tidy table jefferson
UBIFS (on UBI) newer raw-flash devices; UBI is the wear-levelling layer, UBIFS the filesystem in it ubi_reader (ubireader_extract_files)
CPIO archive the initramfs packed with a kernel — technically an archive doing a filesystem's job cpio
ext2/3/4 bigger devices, SD-card and eMMC systems mount it, or debugfs to browse without mounting
YAFFS old Android and NAND-flash devices unyaffs

Only the first row was exercised end to end for this guide: the specimen's SquashFS was carved as 10000.squashfs and unpacked by unsquashfs into squashfs-root, checksums verified. The other rows are surveyed from binwalk's signature and extractor configuration and the tools' own documentation — treat them as a map of what to reach for, not as tested recipes.

The SquashFS wrinkle worth knowing

Real router images are where SquashFS stops being tidy. Vendors build their filesystems with modified compressors and patched tools, and stock unsquashfs may refuse a filesystem that binwalk identified perfectly well. The symptom is distinctive: the carve exists, the extracted tree doesn't. The community's answer is sasquatch, a fork of unsquashfs patched to tolerate the vendor variations; binwalk's extractor rules prefer it when it is installed. If you work through real images, install sasquatch before concluding an image is corrupt — the filesystem chapter of many a forum thread ends there.

When the helper is missing

Binwalk's behaviour is consistent and, once seen, reassuring: the carve always happens; the unpacking is best-effort. A JFFS2 member on a machine without jefferson is still carved out at its offset, intact, waiting for you to unpack it by hand with the right tool. So the troubleshooting reflex for "extraction stopped halfway" is not to re-run binwalk but to read the tree: what was carved, what was unpacked, and which helper the gap between them names.

Two more habits for filesystem work:

  • Prefer browsing to mounting. Mounting an extracted ext image requires root and trusts the image in the kernel. Tools like debugfs (read-only inspection) or simply binwalk's own unpacking keep the untrusted bytes at arm's length.
  • The filesystem is where the secrets are, and also where the work is. Once a rootfs is open, the productive reading is ordinary Linux reading: /etc for configuration, startup scripts for what runs, the web root for the admin interface. None of that needs binwalk any more — which is the point of getting it open.

Check: faced with a firmware image, you can now name the likely filesystem from the scan row, name the helper that unpacks it, and explain a tree that contains a carve but no unpacked folder — a missing helper, not a failed scan.