Category: Electronics

Checking Originality of MicroSD Card

For one of my projects I had to make some data loggers where I used microSD cards to record data. Since I needed the cards in bulk amount, I was trying to be prudent about purchasing them. Local stores here in Toronto seemed to be charging way more than I found online. At the same time I was skeptical about the quality of the microSD cards sold online. I started looking for advices/suggestions and here. I found an interesting and well-researched article. The summary of this article is that if you want buy a MicroSD card from online/retail stores you need to be really careful about counterfeiting and SanDisk and Samsung are less prone to counterfeiting due to their more direct control of their supply chains.

Based on the author’s suggestions, I purchased a bunch of Ultra 8GB SanDisk microSD cards from here. The seller claimed the products to be original. It all came with product codes and a web-link to verify the products. However, to be sure about the quality and the description provided on the product page, I wanted to use a gold standard.

 For windows users H2testw (English translated page hereis considered as the gold standard in detecting counterfeit microSD cards (details on how to use can be found here). Unfortunately, H2testw is not supported in Mac or Linux operating system. A similar alternative to the H2testw is F3 (Fight Flash Fraud/Fight Fake Flash) (here you’ll get a link to download and a good introduction to this program). F3 is an open-source program that uses the same algorithm of H2testw.

Since for the Mac and Linux users there is no GUI for this software, it’s a bit tricky for a novice user like me to use right away after downloading it. I had to look for a couple of websites to understand and learn how to use it properly on a Mac. For the Linux users, the above link along with this post should be useful.

For Mac users, you need to have installed the ‘Command Line Tools for XCode’ available from Apple  for your OS version. Please note, to be able to download it from the Apple website, you need to open a developer account which is free!

Lets consider, you’ve downloaded the F3 (and unzipped if necessary) and installed XCode on your Mac by now. You need to compile the F3 program on your machine to use it. Open the terminal on your Mac and type the following and hit ‘Enter’ (assuming that your F3 file is downloaded in the ‘Downloads’):

$ cd “/Users/Halim/Downloads/f3-5.0” (Don’t type ‘$’ and change the directory appropriately)

This will allow you to access the source code within this folder. Now to compile, type the following & hit ‘Enter’:

$ make

 Wait until the process is completed. Before you insert your media be sure to format it in ‘MS-DOS (FAT)’ mode and I prefer there should be no space in the name, for e.g. in this case I set it to ‘NONAME”. Now type the following and hit ‘Enter’ to execute the program:

 $ ./f3write /Volumes/NONAME

 The above line of code essentially creates 8 files with a total size of about 8 GB (based on the size of your microSD card. Since my microSD card was 8GB it created around 7.39 GB of files). Immediately after running the code it’ll show you how much free space does the media has. The whole process of writing takes quite a bit of time (for me it took around 12 minutes). At the end of the process for a good/original microSD card you should see something like this:

microsd1

Especially it should give you a value for ‘Free Space’ closer to your media size, ‘Free Space’ should be O, and average writing speed should match with the speed class ratings for your media (here you’ll find more details in wikipedia). Then type the following and hit ‘Enter’ to test the reading speed:

$ ./f3read /Volumes/NONAME

This process is much faster than the writing. At the end of this process you should expect something like this:

microsd2

You should especially note if there is any corrupted, changed, or overwritten sections in your media. It’ll also give you an average reading speed of the media.

This is pretty much it. Before I wrap up here is an important piece of advice I got from Users’ Note section from this website. There are some smart counterfeit micorSD cards/medias those can sometimes trick F3 especially on a Mac. To avoid this just disconnect and reconnect the media after writing ($ ./f3write /Volumes/NONAME) process is finished and before entering to the reading ($ ./f3read /Volumes/NONAME) process.

I used a MacBook Pro (Mid 2012) and OS X Yosemite (Version 10.10.4) to test this software for this tutorial. You can use this tutorial to test any volume mounted on a Mac.

A microSD card/media might not be expensive but the data you want to store might be valuable. It is therefore wise to check the integrity of the media before using.

This is my personal note, which I kept for my future use. I’m not an expert in this field, so please use it with caution. If it comes to your any help, I’d be happy since I’m taking to much help from peoples on the web. Feel free to leave comments and suggestions.

LiGER

I’m working on it!