Pcornel
Storage · Filesystems

Filesystem Repair

Cheat sheet · https://pcornel.dk/topic.php?topic=3964

Back to the Topic

Answer

Repair tools reconcile filesystem metadata according to implementation-specific rules. Because repair may discard or rewrite metadata to regain structural consistency, it should follow evidence capture, backup/recovery evaluation and appropriate offline or maintenance-state requirements.

Remember

  • Repair ≠ restore.
  • Repair success ≠ all file contents correct.
  • Filesystem error ≠ purely filesystem root cause.
  • Forced repair ≠ first troubleshooting step.

First checks

  • fsck -n /dev/<dev> — dry run
  • xfs_repair -n /dev/<dev> — XFS dry run
  • chkdsk D: /f — Windows repair

Commands

fsck -n <device>
Operational command for Perform a read-only filesystem consistency check. Focus fields: filesystem type, superblock/che…
zpool scrub

Verify in this order

unmount → check → repair → verify

Where it usually breaks

First mismatch in media/provider → controller/pool → logical object → path/protocol → filesystem/share/object namespace → consumer workload; preserve identity/pre-state before mutation.

Filesystems → Filesystem Repair filesystem map

Filesystem boundaryWhat to verifyProof limit
Identity / attachmentFilesystem type, source/backing object, mount/attachment target and effective optionsPresence or mount state alone does not prove consistency or lower-layer health
Capacity / metadataData space, metadata/inodes, quotas/reservations and filesystem stateFree bytes at one layer do not prove allocation can succeed end to end
Failure boundaryA repair tool reporting success proves it completed its consistency algorithm; it does not prove every user file, application transaction or underlying device is healthy.Correlate filesystem evidence with the backing volume/path/backend before repair
AcceptanceHealthy evidence: lower storage is stable, repair runs in a supported state, consistency checks pass afterward, representative data is readable and the original workload plus recovery protection are verified.Close only after the original path/workload and read-back check succeeds

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3964

Confirmation

Confirm action

Continue?