Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Recover Files and Repair a Corrupted USB Drive in Linux

Identify the right USB drive, copy or image it first, then check its file system or format it only when the files are safe.

Table of Contents

Recover the files before you repair or format a corrupted USB drive. Try a different port and computer first. If files are readable, copy them to another disk and verify the copies. If the drive disconnects repeatedly, reports input/output errors or contains irreplaceable files, stop writing to it and consider professional recovery.

Identify the USB disk and its partitions

Run lsblk -o NAME,PATH,SIZE,MODEL,TRAN,FSTYPE,MOUNTPOINTS before and after plugging it in. Match the size and model to the device. A disk like /dev/sdb contains partitions such as /dev/sdb1. Use the whole disk for imaging and the relevant partition for a file-system check.

How to Fix Corrupted USB in Linux Picture 1

Make an image before repair

Unmount the USB partitions through Disks if they are mounted. Save the image and log to a healthy drive with free space at least as large as the USB device. If the source has read errors, GNU ddrescue can record progress in a mapfile and skip difficult areas on the first pass:

sudo ddrescue -n /dev/disk/by-id/USB_DISK ~/usb-recovery.img ~/usb-recovery.map

Replace USB_DISK with the verified whole-disk identifier and use new output filenames for a new recovery. The older screenshot shows a dd command. Prefer ddrescue if you are dealing with read errors. See the GNU ddrescue manual and these Linux recovery tools.

How to Fix Corrupted USB in Linux Picture 2

Check the file system on an unmounted partition

If the hardware appears healthy and the backup is usable, open Disks, select the correct disk and partition, then use the gear menu. Run Check Filesystem first if offered. Use Repair Filesystem only after reviewing the result and confirming your backup. When using the terminal, select the checker for the file-system type. For example, sudo e2fsck -n /dev/sdX1 checks an unmounted ext file system without applying repairs. Replace the example path with the actual partition. Avoid blindly approving every repair, especially on the only copy.

How to Fix Corrupted USB in Linux Picture 3

How to Fix Corrupted USB in Linux Picture 9

Reformat only if recovery is complete or the files are disposable

Formatting erases the file system. In Disks, verify the selected drive by size and model, unmount the partition, then choose Format Partition if the partition layout is intact. If you need to recreate the layout too, use the disk-level format option and then create a partition. FAT32 works with many older devices but limits individual files to under 4 GiB. Use exFAT when your devices support it and you need larger files, or ext4 for Linux use.

How to Fix Corrupted USB in Linux Picture 4

How to Fix Corrupted USB in Linux Picture 5

How to Fix Corrupted USB in Linux Picture 6

How to Fix Corrupted USB in Linux Picture 7

How to Fix Corrupted USB in Linux Picture 8

How to Fix Corrupted USB in Linux Picture 10

How to Fix Corrupted USB in Linux Picture 11

How to Fix Corrupted USB in Linux Picture 12

After formatting, reconnect the drive, write and read a test file, and eject it normally. If errors recur, retire the drive instead of using it for the only copy of important data. If the file system cannot be repaired but you still need files, consider recovery from an image with PhotoRec.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.