All posts
Engineering 2 min read

Testing USB Drive Capacity

There are a lot of USB drives and other USB devices, like MP4 and MP3 players, that are sold for cheap with the promise of huge storage. Even if you hook it up to your computer, you might see the promised 16 GB of space, but there is a problem: These devices can lie.

Why can they lie? The devices are complicated, but for the sake of this bit, there are two major components at work, the controller and the memory. The controller knows nothing about the memory. When you create a device, you have to tell the controller what memory is attached to it and, here comes the clue, in what size! When your computer tells you it has 16GB on that stick, it reads what the controller has been told by the manufacturer. Now how did that cheap stick turn into a 16GB stick? Crafty people have discovered that they can use some tools to access the controller and change the value with a small piece of software. So they buy large quantities of cheap sticks (512MB or 1GB can be bought for next to nothing) then hack them into saying they are 16GB or whatever else size they come up with, and then sell them for what real sticks go at that size. The profit there is a large multiple.

To make matters worse, you will not recognize the problem until it’s too late. It will allow you to store past it’s real capacity, copying data onto it, and happy write your bits into nirvana once the storage limit is reached. You will only get an error when you try to access what you have copied onto the stick, by that time you might have lost or destroyed the original already.

Fear not, there is help. On heise.de you can find a tool called H2testw for Windows, or if you are hardcore, just H2Test for the command line. No Linux version I know off, sorry.

With this tool, which you can change to English once opened, you will find the culprits easy. Just run it on the stick (be sure to have any data you want off it, and make also sure it’s empty) and it will fill the stick slowly with large files. As it does so, it will check the files if they are correctly written. It will try to fill the entire space the controller says there should be. At the end it will report to you how much space you really have on that stick.

So when you buy something with storage, run H2testw on it and immediately react if you didn’t get what you paid for. This does not only include possible shady Ebay dealers, but also happened with USB sticks sold in retail chains! So be vigilant.