Repairing Corrupted USB Partitions with fsck
When a USB drive contains corrupted file blocks, the fsck utility can scan and repair filesystem errors. This tool works on both individual partitions (such as /dev/sdc1) and entire disks (such as /dev/sdc).
Before runing any repair commands, identify the correct device using:
lsblk
Then execute fsck on the target:
# For a single partition
sudo fsck /dev/sdc1
# For an entire disk
sudo fsck /dev/sdc
After the repair completes, the filesystem should be accessible again.
Completely Wiping a USB Drive
If the drive is completely unreadable and the data stored on it has no value, a full wipe using dd provides a clean slate. This process writes zeros to the entire device, effectively erasing all existing data and partition structures.
First, identify the device path with lsblk, then execute:
# WARNING: This permanently destroys all data on the drive
sudo dd if=/dev/zero of=/dev/sdb bs=4M status=progress
Once the zeroing operation finishes, the drive requires repartitioning using fdisk or a similar tool. After creating the new partition table, format the drive with one of the following commands based on your requirements.
For FAT32 compatibility:
sudo mkfs.vfat -F 32 /dev/sdb1
For Linux-native EXT4:
sudo mkfs.ext4 /dev/sdb1
For Windows NTFS support:
sudo mkfs.ntfs /dev/sdb1
After formatting, the USB drive becomes ready for normal use with the selected filesystem.