Finding bad blocks on USB flash drives

Published on 2011/02/01

|

Last updated on 2015/10/13

|

by Nejc Zupan

After a recent thorough cleaning of my office desk I found a handful of USB sticks. I knew some of them were more or less broken and some should be OK. But which are whic

The solution that first came to mind was to scan USB drives for corrupted sectors / bad blocks. After some Googling around and reading through comments I came up with a process using ‘badblocks’ from ‘ext2fs’ package to scan for bad blocks:

1. Install ext2fsx.
2. Insert USB drive.
3. Backup data from the USB drive because ‘badblocks’ removes all data from the stick.
4. Identify USB drive in console.

$ mount
... snip ...
/dev/disk1 on /Volumes/NO NAME (msdos, local, nodev, nosuid, noowners)

5. Unmount USB drive so we can run ‘badblocks’ on it.

$ sudo umount -f /Volumes/NO\ NAME/

6. Run badblocks to identify and mark bad block

WARNING: badblocks removes all data on drive. Make sure you have a backup and that you don’t mistype the drive’s i

$ badblocks -vw /dev/disk1

7. Use ‘Disk Utility’ to format the drive so you can actually use it.