How To Fix A Corrupted USB Drive In Linux (2026)
A USB drive that will not mount, shows as empty or throws errors in Linux is usually fixable if you go in a careful order.
Most of the time the filesystem is damaged and the drive itself is healthy, so your files can often be saved before you repair anything.
This guide takes 15 to 30 minutes for a small drive, and it keeps your data safe by copying it first.
Table of Contents
- Quick answer: which tool fixes which filesystem?
- Step 1: find the right device name
- Step 2: unmount the partition first
- Step 3: copy your data off before repairing
- Step 4: run a check that changes nothing
- How do I repair a FAT32 USB drive in Linux?
- How do I repair an exFAT USB drive?
- How do I repair an ext4 USB drive?
- How do I fix an NTFS USB drive on Linux?
- Step 5: reformat the drive if repair fails
- What if the drive still isn’t detected or keeps failing?
Quick answer: which tool fixes which filesystem?
| Filesystem | Check without changes | Repair |
|---|---|---|
| FAT32 | fsck.vfat -n | fsck.vfat -a |
| exFAT | fsck.exfat -n | fsck.exfat -p or -r |
| ext4 (Linux) | e2fsck -n | e2fsck -p or -y |
| NTFS | ntfsfix -n | ntfsfix, then run Windows chkdsk |
These options come from the manual pages for each tool, and the sections below explain when to use each one.
Step 1: find the right device name
Plug the drive in and list your disks to identify it by size and label.
lsblk -f
A USB drive usually appears as something like sdb with a partition such as sdb1, but your names will differ.
Run sudo dmesg | tail right after plugging it in if the drive does not appear, since the kernel log shows detection errors.
If the drive never shows up in either place, skip to the hardware section below.
Step 2: unmount the partition first
Never repair a mounted filesystem, because the changes can corrupt it further.
sudo umount /dev/sdb1
The e2fsck manual says running it on a mounted filesystem is generally unsafe, and the same rule applies to every repair tool here.
If the drive reports busy, close any file manager windows that are open on it and try again.
Step 3: copy your data off before repairing
A repair tool changes the drive, so save a copy of the whole thing first if the files matter.
GNU ddrescue is built for this because it reads the good areas first and keeps going past read errors, unlike plain dd.
sudo ddrescue -n /dev/sdb usb.img usb.map
The map file records progress, so you can stop and resume the copy.
The ddrescue manual also warns against repairing a filesystem on a drive that is throwing I/O errors, since that can lose more data.
Save the image to a different disk with enough free space, never to the USB drive itself.
Step 4: run a check that changes nothing
Start with a read-only check so you see the damage before you fix it.
| Command | What it does |
|---|---|
| sudo fsck.vfat -n /dev/sdb1 | Checks FAT without writing anything |
| sudo fsck.exfat -n /dev/sdb1 | Checks exFAT only, with no repair |
| sudo e2fsck -n /dev/sdb1 | Opens ext filesystems read-only and answers no to every question |
| sudo ntfsfix -n /dev/sdb1 | Writes nothing and reports what it would do |
The generic fsck -N flag also performs a dry run and shows what would be done.
How do I repair a FAT32 USB drive in Linux?
FAT32 is the most common format on small flash drives.
sudo fsck.vfat -a /dev/sdb1
The -a option repairs without prompting and, where there is more than one possible fix, uses the least destructive one.
The manual notes that fsck.fat detects invalid boot sector parameters but does not repair them.
If that is your problem, a reformat is the likely route.
How do I repair an exFAT USB drive?
Large flash drives and SD cards are often exFAT, and the repair tool comes from the exfatprogs package.
sudo fsck.exfat -r /dev/sdb1
The -r option asks before each change, while -p repairs without prompts only when it can do so safely.
The manual says directory entries with an invalid checksum or invalid values are deleted and not fixed, so some files may vanish.
How do I repair an ext4 USB drive?
Drives formatted for Linux use the e2fsck tool.
sudo e2fsck -p /dev/sdb1
The -p option fixes only problems that are safe to fix automatically and reports the rest.
Use -f to force a check even when the filesystem looks clean, and -y only if you accept yes to every repair prompt.
If the main superblock is damaged, e2fsck can use a backup one with the -b option.
How do I fix an NTFS USB drive on Linux?
NTFS drives are handled with ntfsfix, which has strict limits.
sudo ntfsfix /dev/sdb1
The manual says ntfsfix is not a Linux version of chkdsk and fixes only basic inconsistencies.
It resets the NTFS journal and schedules a consistency check for the next time the drive is used in Windows.
For a serious NTFS problem, plug the drive into a Windows PC and run chkdsk there.
| Tool | Exit code 0 | Exit code 1 | Exit code 4 |
|---|---|---|---|
| e2fsck | No errors | Errors corrected | Errors left uncorrected |
| fsck.vfat | No recoverable errors | Recoverable errors detected | Not documented on its manual page |
Check the exit code with echo $? right after a repair to see whether it worked.
Step 5: reformat the drive if repair fails
If the filesystem is beyond repair and you have your files saved, formatting creates a clean one.
sudo mkfs.vfat -n USBDISK /dev/sdb1
If the partition table itself is broken, you may need to create a new partition first with a tool such as fdisk before formatting.
For another USB project on Linux, see our guide to making a bootable flash drive.
What if the drive still isn’t detected or keeps failing?
Input/output errors, a drive that disconnects, or a drive that never appears in lsblk or dmesg point to failing hardware.
- Try a different USB port and cable or a different computer.
- Use ddrescue for the copy and stop running repair tools on it.
- Use a recovery service if the files are valuable.
Flash drives wear out, so replace one that has failed and keep backups of anything important.
If you work with phones on Ubuntu, our guide to mounting an iPhone as an external drive covers a related mount problem.
Official sources used: GNU ddrescue manual and the Linux manual pages for e2fsck and fsck.vfat.
wonderful great help