[ale] Testing USB sticks

Ed Cashin ecashin at noserose.net
Wed Nov 18 08:56:56 EST 2009


On Tue, Nov 17, 2009 at 11:04 AM, Chris Fowler
<cfowler at outpostsentinel.com> wrote:
> Here is how I test USB sticks, MP3 players, etc bought from China on
> eBay.
>
> 1.  Determine the reported size of the device
> 2.  Create a file of random bytes (/dev/urandom) close to that size.
> 3.  Copy to stick
> 4.  md5sum both the file on your hard disk and the one on the stick.
>
> If it matches the the size reported is the size of the flash.
>
> Is there a better way?

I don't know anything about the kind of programming that
went into creating a working USB drive, but in general, I've
found that the test you're talking about is one of the first two
tests I'll do on anything that claims to store data but might
have bugs.

It's the sequential I/O test.  It's best if it can hit the very
first and last addressable place on the storage medium,
because boundary cases are places where programmers
often make mistakes.  So the exact size is a lot better than
the approximate size.

The other test is the random I/O test, where data is sprinkled
around the drive.  You can do that based on your same input
file but using random-sized chunks of data at random offsets.
When you've written all the data that way, the checksum should
still match.

-- 
  Ed Cashin <ecashin at noserose.net>
  http://noserose.net/e/
  http://www.coraid.com/



More information about the Ale mailing list