Updated: 12 October 2026 · Applies to: Ubuntu 26.04 (util-linux 2.41.3, e2fsprogs 1.47.2, systemd 259) and Debian 13 (util-linux 2.41.5, e2fsprogs 1.47.2, xfsprogs 6.13, btrfs-progs 6.14, ntfs-3g 2022.10.3)

fsck (file system consistency check) checks a Linux file system and repairs it. To run it manually, unmount the partition and force a full check: sudo umount /dev/sdb1, then sudo fsck -f /dev/sdb1, or sudo fsck -fy /dev/sdb1 to answer "yes" to every repair. The root file system cannot be unmounted, so check it from a rescue system or force a check at boot with the kernel option fsck.mode=force. NTFS (Windows) disks have no fsck on Linux: repair them with chkdsk on Windows.

What fsck is

fsck is a front end. It detects the file system type and runs the matching checker: fsck.ext4 (which is e2fsck) for ext2, ext3 and ext4, fsck.fat for FAT USB sticks. -N shows what it would run:

$ sudo fsck -N /dev/sdb1
fsck from util-linux 2.41.5
[/usr/sbin/fsck.ext4 (1) -- /dev/sdb1] fsck.ext4 /dev/sdb1

We tested on disk images attached as real block devices in a lab kernel; the device names are changed to /dev/sdb1, /dev/sdc1 and /dev/sdd1 in the output here.

How to run fsck manually

  1. Find the partition and its type with lsblk -f.
  2. Unmount it: sudo umount /dev/sdb1. On a mounted ext4 file system, fsck stops:
    /dev/sdb1 is mounted.
    e2fsck: Cannot continue, aborting.
  3. Check it without changing anything (-n answers "no" to every question). We damaged one file's inode first:
    $ sudo fsck -fn /dev/sdb1
    fsck from util-linux 2.41.5
    e2fsck 1.47.2 (1-Jan-2025)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Entry 'app.php' in /www (13) has deleted/unused inode 15.  Clear? no
    ...
    data: ********** WARNING: Filesystem still has errors **********
    (shortened). The exit code was 4, "errors left uncorrected".
  4. Repair it:
    $ sudo fsck -fy /dev/sdb1
    ...
    Entry 'app.php' in /www (13) has deleted/unused inode 15.  Clear? yes
    ...
    Free inodes count wrong (32752, counted=32753).
    Fix? yes
    
    data: ***** FILE SYSTEM WAS MODIFIED *****
    data: 15/32768 files (0.0% non-contiguous), 13918/131072 blocks
    (shortened). Exit code 1 means errors were corrected. Run sudo fsck -f /dev/sdb1 again until it finishes with exit code 0, then mount the partition.

Always add -f. Without it, e2fsck trusts the "clean" flag. In our test, right after damaging the inode, fsck /dev/sdb1 printed data: clean, 16/32768 files with exit code 0; only -f found the error. Also, e2fsck run from a script without -y, -n or -p stopped with e2fsck: need terminal for interactive repairs.

fsck options

  • -f: check even if the file system is marked clean (e2fsck).
  • -y: repair everything without asking. -n: check only, change nothing.
  • -p: fix only problems that are safe to fix without asking (in our test: Entry 'app.php' ... CLEARED.).
  • -b 32768: use a backup superblock. When the main superblock is damaged, e2fsck says so and suggests the backup numbers to try.
  • -N: show what would be run. -C 0: progress bar. -t ext4: only this type.
  • -A: check the file systems in /etc/fstab whose last field (the pass number) is above 0 (our FAT entry with 0 was skipped); -R with -A skips the root file system, -M skips mounted file systems (it printed nothing and returned 0 for our mounted disk).

Exit codes, according to the fsck manual: 0 no errors, 1 errors corrected, 2 reboot needed, 4 errors left uncorrected, 8 operational error, 16 usage error, 32 cancelled, 128 shared-library error. To scan for bad blocks, see How to Check a Disk for Bad Blocks and Errors in Linux.

Check the root file system (Ubuntu and other systemd systems)

  • Force a check at the next boot: in the GRUB menu press e, add fsck.mode=force fsck.repair=yes to the end of the line that starts with linux, then press Ctrl+X to boot (GRUB manual). According to systemd, fsck.mode is auto, force or skip, and fsck.repair is preen (the default), yes or no. See How to Change GRUB Kernel Parameters Before Booting on Linux.
  • Do not rely on /forcefsck. We checked the systemd source: versions 258 and later (Ubuntu 26.04 has 259) no longer look for this file, and versions 255 to 257 still act on it but log "Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system."
  • Ubuntu recovery menu: choose Advanced options for Ubuntu, then the entry ending in (recovery mode), then fsck ("Check all file systems").
  • Rescue system: boot a rescue system, find the disk with lsblk and run fsck -f on the unmounted root partition. On a Ucartz VPS, use How to Enable Rescue Mode for Your VPS Using Virtualizor; to watch the boot, open the VNC console (How to Access Your VPS via VNC in Virtualizor).

Boot-time checks only run for file systems whose last /etc/fstab field is above 0 (according to systemd). New ext4 file systems are not checked by mount count or time: tune2fs -l showed Maximum mount count: -1 and Check interval: 0 (<none>). sudo tune2fs -c 30 -i 1m /dev/sdb1 turns on a check every 30 mounts or every month. More in Maintaining Linux filesystems using fsck and tune2fs.

XFS and Btrfs: fsck does nothing

$ sudo fsck /dev/sdc1
fsck from util-linux 2.41.5
If you wish to check the consistency of an XFS filesystem or
repair a damaged filesystem, see xfs_repair(8).

For XFS, unmount and run sudo xfs_repair -n /dev/sdc1 to check, then without -n to repair (Running repairs on XFS Filesystems). For Btrfs, fsck points to btrfs check, which only reads by default (ours ended with no error found).

fsck.ntfs not found: NTFS disks

$ sudo fsck /dev/sdd1
fsck from util-linux 2.41.5
fsck: fsck.ntfs not found; ignore /dev/sdd1

The exit code is 0, but nothing was checked. Even with ntfs-3g 2022.10.3 installed there is no fsck.ntfs, and we found no NTFS checker in the Ubuntu 26.04 repositories. ntfs-3g includes ntfsfix, and its manual says it "is NOT a Linux version of chkdsk": it repairs only some basic problems, resets the NTFS journal and schedules a check for the next Windows boot. sudo ntfsfix -n /dev/sdd1 shows what it would do. For a real repair, connect the disk to Windows.

fsck on Windows

  • The Windows equivalent is chkdsk. According to Microsoft, chkdsk D: /f fixes errors (the disk must be locked; if it is in use, chkdsk offers to check it at the next restart) and /r also looks for bad sectors. In PowerShell, Repair-Volume -DriveLetter D -Scan only scans and -OfflineScanAndFix equals chkdsk /f.
  • To check a Linux (ext4) disk from Windows 11, attach it to WSL 2 as administrator with wsl.exe --mount \\.\PHYSICALDRIVE2 --bare, run lsblk and sudo fsck -f inside Linux, then wsl.exe --unmount \\.\PHYSICALDRIVE2. According to Microsoft, wsl --mount does not support USB drives and SD card readers. See How to Run Linux and Linux Apps on Windows 10 and 11 (WSL).

Official documentation: e2fsck manual, chkdsk (Microsoft).

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)