{
  "slug": "e2fsck",
  "term": "e2fsck",
  "aliases": [
    "ext2/ext3/ext4 filesystem checker"
  ],
  "definition": "e2fsck is the e2fsprogs utility for checking and repairing ext2, ext3 and ext4 filesystem structures.",
  "note": "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. [implementation]\n\nThe -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. [manual] [implementation]\n\nExit 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. [status-flags] [configuration]\n\nHesela'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. [metadata-checksums]\n\nIn 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. [native-coverage] [problem-policy]",
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-12-04",
  "advantages": [
    {
      "text": "Accepts a filesystem image file as well as a block device.",
      "citationIds": [
        "manual"
      ]
    }
  ],
  "limitations": [
    {
      "text": "The -z undo file does not provide recovery from a system or power crash.",
      "citationIds": [
        "manual"
      ]
    }
  ],
  "related": [
    "ext4",
    "filesystem-consistency-invariant",
    "crash-consistent-filesystem-repair",
    "e2undo"
  ],
  "citations": [
    {
      "id": "manual",
      "title": "e2fsprogs v1.47.3: e2fsck manual, modes and undo-file limits",
      "url": "https://raw.githubusercontent.com/tytso/e2fsprogs/v1.47.3/e2fsck/e2fsck.8.in",
      "accessed": "2026-12-04"
    },
    {
      "id": "implementation",
      "title": "e2fsprogs v1.47.3: mounted check, clean shortcut and journal recovery",
      "url": "https://raw.githubusercontent.com/tytso/e2fsprogs/v1.47.3/e2fsck/unix.c",
      "accessed": "2026-12-04"
    },
    {
      "id": "status-flags",
      "title": "e2fsprogs v1.47.3: filesystem-checker exit flags",
      "url": "https://raw.githubusercontent.com/tytso/e2fsprogs/v1.47.3/e2fsck/e2fsck.h",
      "accessed": "2026-12-04"
    },
    {
      "id": "configuration",
      "title": "e2fsprogs v1.47.3: allow_cancellation and problem-policy configuration",
      "url": "https://raw.githubusercontent.com/tytso/e2fsprogs/v1.47.3/e2fsck/e2fsck.conf.5.in",
      "accessed": "2026-12-04"
    },
    {
      "id": "metadata-checksums",
      "title": "Linux v6.16: ext4 metadata checksum coverage",
      "url": "https://raw.githubusercontent.com/torvalds/linux/v6.16/Documentation/filesystems/ext4/checksums.rst",
      "accessed": "2026-12-04"
    },
    {
      "id": "native-coverage",
      "title": "Hesela: e2fsck coverage, 11 controlled cases repeated twice",
      "url": "https://hesela.dev/research/e2fsck-coverage/README.md",
      "accessed": "2026-12-04"
    },
    {
      "id": "problem-policy",
      "title": "e2fsprogs v1.47.0: PR_5_FREE_BLOCK_COUNT and fix_problem refusal policy",
      "url": "https://raw.githubusercontent.com/tytso/e2fsprogs/v1.47.0/e2fsck/problem.c",
      "accessed": "2026-12-04"
    }
  ],
  "provenance": [
    "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."
  ]
}
