Has my USB Flash Drive bit the dust

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

Discussion on testing to see if a USB stick has gone bad - there is no S.M.A.R.T. data to go on when trying to determine if your USB memory stick bit the dust. We will discuss some ways to test the USB flash memory drive here.

First DETERMINE where you USB Flash is mounted so you don't wipe out your primary drive!!!

I simply use the command "fidsk -l|grep sd.." before I insert the flash and again after. It wont always be the same depending on the system and what other media is connected but as an example my flash is on /dev/sdc

badblocks

This is a data destructive test. Don't do this if you have any plans to attempt data recovery on the drive. This test will help you determine if the USB flash drive can still be used or if it needs to go in the rubbish bin.

  1. determine where the USB flash is mounted (for this example sdc)
  2. run the command:
sudo badblocks -w -s -o usbstick.log /dev/sdc

Notice there is no partition number, just the device sdc (not sdc1 or sdc2 etc...)

The badblocks command here will destroy all data on the flash drive. Failures may be due to the flash drive memory controller or capacity has been maxed on space to remap failed blocks which is another way of saying "too many failed blocks." Either of these issues indicates the drive is toast.

The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes

A Parted / GParted error message that is displayed when a failing USB flash drive has been inserted.

GParted is showing a 16MB flash drive is something odd like 58.27GB. Errors pop up when GParted is opened complaining about the driver descriptor.

This could indicate either that (A) your flash drive has a bad memory controller or other physical problem and is toast or (B) it is physically fine however someone used a low-level device tool and mistakenly wrote the incorrect block size onto the drive. You can check if the drive is bad after you attempt to correct the block size. (my examples use sdc but your assignment might be different!)

sudo dd if=/dev/zero of=/dev/sdc bs=2048 count=32 && sync

This will clear the Master Boot Record.

Result on a 16GB drive:

# fdisk -l /dev/sdc
Disk /dev/sdc: 14.6 GiB, 15640600576 bytes, 30548048 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes