fsck.fat - Linux


fsck.fat is a command-line utility used to check and repair the integrity of FAT (File Allocation Table) file systems, commonly found on USB drives, SD cards, and legacy Windows systems. It scans the file system for inconsistencies, such as bad sectors, lost clusters, or corrupted file structures, and attempts to fix them automatically.




  • -a: Automatically fix detected errors without user interaction.
  • -l: Lock the file system before performing any operations.
  • -p: Do not print the progress of file system checks.
  • -r: Attempt to recover lost files and directories.
  • -s: Only check the file system without making any changes.


  • Check the file system of a USB drive mounted at /dev/sdb1:

    fsck.fat /dev/sdb1
  • Automatically fix errors on an SD card located at /dev/mmcblk0p1:

    fsck.fat -a /dev/mmcblk0p1
  • Recover lost files and directories from a corrupted file system:

    fsck.fat -r /dev/sda2

Common Issues

  • Invalid partition table: The file system may be located on a partition with an invalid partition table. Use fdisk or gdisk to correct the partition table.
  • Bad sectors: If the file system contains bad sectors, fsck.fat may not be able to repair it. Consider using a data recovery tool or replacing the storage device.
  • Power outages: If a power outage occurs during file system operations, it may corrupt the file system, requiring a full recovery using fsck.fat -r.


fsck.fat can be integrated into scripts or command chains for automating file system maintenance tasks. For example:


# Loop through all mounted FAT file systems
for mnt in $(mount | grep fat); do
  # Check and repair the file system
  fsck.fat -a $mnt

Related Commands

  • mkfs.fat: Create a new FAT file system.
  • mount: Mount a file system.
  • df: Display file system usage.
  • tune2fs: Check and repair ext2/ext3/ext4 file systems.