LinuxCommandLibrary

fsck.fat

Check and repair FAT filesystems

SYNOPSIS

fsck.fat [options] device

PARAMETERS

-a, --auto
    Automatically repair filesystem without prompting (equivalent to -p)

-A
    Not supported (for compatibility)

-b <start>
    Use alternate superblock at sector start

-f
    Force check even if filesystem seems clean

-l <size>
    Add size clusters to free cluster count

-n
    Read-only check, no modifications

-p
    Preen mode: fix simple errors silently (default)

-r
    Interactive repair mode with user prompts

-s
    Salvage maximum content from filesystem

-t
    Test mode (equivalent to -n)

-u
    Salvage contents of deleted files

-v
    Verbose output

-V
    Verification pass after repairs

-w
    Write changes immediately

-y
    Assume 'yes' to all prompts

-4
    Support FAT32 filesystems

-?
    Display help

DESCRIPTION

fsck.fat is a Linux utility from the dosfstools package designed to check and optionally repair FAT12, FAT16, and FAT32 filesystems. Commonly used for USB drives, SD cards, and other removable media formatted with FAT, it scans the boot sector, File Allocation Table (FAT), root directory, and file entries for errors like lost clusters, cross-linked files, bad sectors, or inconsistent chain counts.

It operates in read-only, automatic repair, or interactive modes, making it essential for data recovery on non-native Linux filesystems. The tool reports errors such as invalid FAT entries, orphaned inodes, or directory label issues and can mark bad clusters, rebuild FATs, or recover deleted files. Always unmount the device first (umount /dev/sdX1) to avoid corruption. While effective, aggressive repairs risk data loss, so backups are advised. It supports VFAT long filenames and is invoked via fsck as fsck.vfat or dosfsck.

CAVEATS

Always unmount device first; repairs may cause data loss—backup recommended. Not for exFAT or NTFS. Running on mounted filesystem risks corruption. Use -n for dry-run testing.

EXAMPLES

fsck.fat -a /dev/sdb1
Automatically repair FAT on sdb1.

fsck.fat -r -v /dev/sdc1
Interactive verbose repair.

fsck.fat -n /dev/sdd1
Read-only check.

EXIT CODES

0: No errors; 1: Errors corrected; 2: Reboot needed; 4: Errors left uncorrected; 8: Fatal error.

HISTORY

Originally developed by Werner Almesberger in 1992 as part of the dosfstools suite for Linux FAT support. Maintained by Andreas Bombe since 2000s, with updates for FAT32 and VFAT. Widely used in distributions for removable media maintenance.

SEE ALSO

fsck(8), dosfsck(8), mkfs.fat(8), fatlabel(8), mtools(1)

Copied to clipboard