--- title: fsck (file system check) — File system integrity check and repair date: 2026-10-20 time: 12:00 model: admin category: programs author_type: human summary: A checking tool that verifies file system metadata and repairs errors interactively. tags: program, File and disk management, fsck --- A checking tool that verifies file system metadata and repairs errors interactively. ## Basic Information | Command Name | fsck (file system check) | | --- | --- | | One-line Introduction | A checking tool that verifies file system metadata and repairs errors interactively. | | Provided by | e2fsprogs / util-linux (preinstalled on most distributions) | | Official Documentation | https://man7.org/linux/man-pages/man8/fsck.8.html | | Supported Operating Systems | Linux, WSL | | Installation Status | Installed by default (no separate installation needed) | | Category | Linux file and disk management (tags: filesystem, check, repair, e2fsck) | ## What is this command? fsck checks the superblock, inodes and block bitmaps of a file system to find damaged metadata. Depending on the file system type it delegates to a tool such as e2fsck or xfs_repair. It must be run on an unmounted file system; during boot systemd performs the check automatically. The run may continue with interactive prompts asking whether to repair each problem. ## What problems does it solve? - A file system may be damaged after an unclean shutdown - Mounting fails with metadata corruption messages - You want to verify integrity before replacing a disk - The boot-time check keeps repeating ## Key features ### Read-only check The -n option reports problems without changing anything. - **When to use**: You want a diagnosis before changing anything - **What you get**: A summary of found errors and an exit code - **Limitations**: The file system stays untouched even if errors remain. ### Automatic repair The -y option answers yes to every question and repairs in bulk. - **When to use**: You have a backup and need a fast repair - **What you get**: A repaired file system - **Limitations**: An incorrect repair can damage data further. ### File system specific tools ext4 uses e2fsck, XFS uses xfs_repair and Btrfs uses btrfs check. - **When to use**: You need a check tailored to one file system - **What you get**: Results from the appropriate checker - **Limitations**: Options and repair policies differ between tools. ## Installation and usage ### Check whether it is installed ``` fsck --version ``` sudo apt install e2fsprogs # Debian/Ubuntu sudo dnf install e2fsprogs # Fedora ## Real-world examples ### Read-only check Unmount the file system, then check without changes. ``` sudo umount /dev/sdb1 sudo fsck -n /dev/sdb1 ``` ### Repair automatically Repair in bulk when a backup exists. ``` sudo fsck -y /dev/sdb1 ``` ### ext4 specific check Use e2fsck and also scan for bad blocks. ``` sudo e2fsck -f -c /dev/sdb1 ``` --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/fsck.html This file is an auto-generated Markdown twin of the DevHub document.