How to check a usb stick
In order to check a usb stick we’ll use the software badblocks. Badblocks will write and read data on every block of the usb device and compare them.
There are three modes for badblocks :
- Write and read all the blocks
badblocks -w /dev/<device>
- Read-Write without erasing any data
badblocks -n /dev/<device>
- Only read data (default mode)
badblocks /dev/<device>
You can add the following options :
-v for verbose output
-o <output file> write the badblocks list to a file
-p <number> pass number
-s show the progress of the analysis
-b <size of the blocks>, it must be in octet, the default value is 1024.
In any case, it is best to make a backup before using badblocks. The tests are very time intensive, it can take hours depending on the drive speed.
I have made some tests on a 16Gb usb stick from 2008 and it has taken more than 3 hours.