1

I have a flash disk possibly with bas sectors. When I try to copy data to it, it works fine until somewhere around 460Mb, and then the files start getting corrupted. The corruption happens only when I unmount and remove the drive, before unmounting, the files are fine. The linux program 'badblocks' doesn't find any bad blocks. I tried formatting it, but that didn't have any effect. I used Fat 16 and 32, and both had the same problem. Is there a way to test for bad blocks after unmounting and how do I fix them?

2 Answers 2

0

I guess you have synchronization problem... Before unmount do the synchronization by sync command.

If this solution will not resolve your problem, you can try hard format your USB stick by 'dd' command

sudo dd if=/dev/zero of=/dev/sd?

then create partition and do a format.

Either those solutions will not work say bye to your stick..

6
  • No dice. And i tried the dd a long time ago. Now to head to the local PC store. :(
    – 3eee3
    Jan 6, 2012 at 15:06
  • Did you try 'sync' command? may be you are not in trouble with bad sectors. Also you said "The linux program 'badblocks' doesn't find any bad blocks". I'm sure bad sectors are not invisible. So there were 2 options left. One is 'sync' command, the other is funeral of a stick ...
    – Sencer H.
    Jan 6, 2012 at 15:10
  • Tried that. But it always fails at the same point. What else could that be?
    – 3eee3
    Jan 6, 2012 at 15:22
  • I have no idea... :-/
    – Sencer H.
    Jan 6, 2012 at 15:33
  • Did you try to use stick in completely different machine with windows installed?
    – Sencer H.
    Jan 6, 2012 at 15:47
0

You can't.

From my experience USB flash memory doesn't remap bad blocks like a hard disks do. Once you get a write or read error - the drive is pretty much trash, as you can no longer trust it with any of your data. Many drives will seemingly perform writes without problems, but then give you corrupt data during reads.

Perform a test with f3 http://oss.digirati.com.br/f3/

F3 stands for Fight Fake Flash or Fight Flash Fraud It's a tool designed to perform write/read tests on flash memory (or other media) to discriminate working, failing and fake flash memory.

To test your drive with f3:

  1. Install the F3 tool: apt install f3
  2. Format and mount the drive you want to test
  3. Open terminal in the root directory of your drive
  4. Execute this command: f3write .; f3read .; - this will first create test files, then read them back comparing to expected output. You'll get a detailed report on the write/read speeds and errors encountered while reading the data.
    1. After the test is over you can remove all test files rm *.h2w

If the test reports errors - my advice is to throw away the drive and buy something form a reputable vendor (for example: Kingston, pqi, Verbatim, Silicon Power). Cheap no-names tend to have a varying quality, sometimes abominable. Every now and then I deal with a batch of flash drives where 50% of the units are trash.

PS: I handle thousands of pendrives at work and I've developed an in-house tool based on f3 to conveniently test massive amounts of drives.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .