e2fsck · shipping · also ext2/ext3/ext4 filesystem checker

e2fsck

e2fsck is the e2fsprogs utility for checking and repairing ext2, ext3 and ext4 filesystem structures.

Related Observatory article: Read on hesela.com

A clean-state shortcut can end a normal invocation before the checking passes; -f bypasses that shortcut. A successful exit therefore does not establish which checks ran. In v1.47.3, declining the interactive mounted-filesystem warning also exits with status 0. [2]

The -n option selects read-only checking and refuses proposed changes; in v1.47.3 it also skips required journal replay. The manual says mounted-filesystem results are invalid. The -p policy permits only repairs classified for unattended correction, whereas -y accepts repair questions; these are not interchangeable recovery policies. [1] [2]

Exit values encode conditions, not an ordered severity score. Here 0 reports no errors, 1 corrected errors, 2 a reboot requirement, 4 unresolved errors, 8 an operational error, 16 a usage error, 32 cancellation and 128 a shared-library error. Retain the complete status and transcript. The optional allow_cancellation setting can make user cancellation via Ctrl-C return 0 when the filesystem is not explicitly marked erroneous; its default is false. [3] [4]

Hesela's interpretation: checking filesystem structures does not authenticate application bytes or establish their latest intended version. Ext4 metadata checksums cover defined structures, not arbitrary file payloads. [5]

In two native 1.47.0 runs, a changed payload still passed forced checking. A wrong superblock free-block total was reported and left unchanged by -f -n, also with status 0; a wrong inode link count returned 4. PR_NO_OK permits refusal for that counter problem without invalidating the filesystem. The distinction is problem-specific, not a claim that every refused repair succeeds. [6] [7]

Relations

related
Ext4, Filesystem consistency invariant, Crash-consistent filesystem repair, e2undo

Advantages

  • Accepts a filesystem image file as well as a block device. [1]

Limitations

  • The -z undo file does not provide recovery from a system or power crash. [1]

Citations

  1. e2fsprogs v1.47.3: e2fsck manual, modes and undo-file limits (accessed 2026-12-04)
  2. e2fsprogs v1.47.3: mounted check, clean shortcut and journal recovery (accessed 2026-12-04)
  3. e2fsprogs v1.47.3: filesystem-checker exit flags (accessed 2026-12-04)
  4. e2fsprogs v1.47.3: allow_cancellation and problem-policy configuration (accessed 2026-12-04)
  5. Linux v6.16: ext4 metadata checksum coverage (accessed 2026-12-04)
  6. Hesela: e2fsck coverage, 11 controlled cases repeated twice (accessed 2026-12-04)
  7. e2fsprogs v1.47.0: PR_5_FREE_BLOCK_COUNT and fix_problem refusal policy (accessed 2026-12-04)
Sources & caveats
  • Tagged source review: e2fsprogs v1.47.3 and Linux v6.16, accessed 2026-12-04.
  • Separate native evidence: e2fsprogs 1.47.0 on new unmounted 64 MiB ext4 regular-file images, metadata_csum enabled and no journal; 11 deliberate cases repeated twice on one host.
  • No block-device access, mounted checking, journal replay, crash injection or SQCK replication. Captures, binary/script hashes and verification code accompany the evidence.

JSON: /data/terms/e2fsck.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. e2fsck. Hesela. 2026-12-04. https://hesela.dev/terms/e2fsck/