How to Fix a Broken USB Drive Using Linux

If a USB flash drive stops working, here's what to do

If you create a Linux USB drive and the drive becomes unusable, format the USB drive using the fdisk tool in Linux so that you can copy files to it and use it as you ordinarily would. The fdisk tool is similar to the diskpart tool in Windows. After you reformat the USB drive, it will be usable on any system that reads FAT32 partitions.

These procedures erase everything on the USB drive. Back up the files on the drive before you reformat it.

Causes of Broken USB Drives

A broken drive arises most frequently because of either direct hardware damage—in which case, no software fix will recover it—or corruption of the file system. Often, file system problems arise from pulling the drive from the computer before it's finished a read/write transaction.

USB flash drive with laptop
bluehill75 | Getty Images

How to Fix a Broken USB Drive

In most cases, a broken USB drive must be reformatted.

  1. Check the drive for damage. A damaged drive, even if you can recover some data, should not be used. It may, for example, damage the USB port on your computer.

  2. Determine if the drive will mount. Insert the drive to see if the computer recognizes the USB drive. If the drive doesn't auto-mount, a shell command like hwinfo or lsblk lists active devices. If the disk isn't listed, Linux doesn't recognize it. If it's listed but not auto-mounted, use the mount command.

  3. Evaluate the value of the content of the drive. If it's irreplaceable, you may have some luck with a disk-recovery tool, although for damaged hardware, this process is hit-or-miss.

  4. Create a new partition. Run a disk-format utility like fdisk or cfdisk to create a new partition. This process destroys the data on the disk and re-creates the file system.