Buying No-Name SD Cards from China
Introduction
So I finally decided to upgrade the self-built firewall/gateway for my home internet connection [1]. I replaced an old Raspberry Pi Model B revision 1 (rpi B1) with a more powerful Pine A64. The transition was seamless, but I found myself in need of a microSD card (the rpi B1 was using a full-size SD card). I resorted to a random class-2 [2] 4 GB card I had laying around that worked beautifully.
With my internet connection working again I was left wondering: can I do better with as little money as possible? What if I buy some random microSD card(s) on a famous online retail service based in China?
Many articles (such as [3] and [4]) test the speed of microSD cards but none deal with no-name brands. Moreover, it turns out that buying cheap from china may be a waste of money due to fake products [5]. But how bad the situation really is? People usually buy high-capacity drives and end up receiving 8-16 GB cards with a fake firmware that reports a different disk size to the OS. I don't need much space for a standalone router thing. What if I buy small microSD cards directly? Will they be fake nonetheless or will they be the real thing? I found no answer to this question on the web so I decided to run an experiment myself.
The Funny microSD Cards under Test
On a whim I bought 4 microSD cards for the same price as one 8 GB card from a reputable brand. Those cards have some the funniest names I've ever seen. Upon arrival I also noticed that they are stamped with the most weird and nonsensical approvals and speed ratings.
As a bonus, I added to the test batch two more reasonable cards I acquired while waiting for the shipment to arrive: a 4 GB card labelled 'eb-flash' and an official Raspberry Pi 16 GB microSD card.
The Test Script
To test the cards I used the f3 - Fight Flash Fraud tools [6] with a custom script for repeatability. The usage guide [7] does not provide a reference script for testing cards, so I had to make my own.
#!/bin/sh -e
#
# sdcard_test.sh - test sdcards for fake/broken flash
######################################################
# WARNING! This script will eat your data. Set those variables correctly
DEV="/dev/mmcblk0"
MOUNTPOINT="./mnt"
# Print some info on the device (will fail if $DEV does not exists)
fdisk -l $DEV
# Perform a destructive test on the device
echo ""
f3probe --destructive --time-ops $DEV
# Get first partition name, format it, mount it and run read/write tests
part=$(fdisk -l $DEV | awk 'END {print $1}')
echo ""
echo First partition is $part, formatting it to FAT32
umount $part || true
mkfs.fat -F32 $part
echo ""
echo Performing R/W test on $part
mount $part $MOUNTPOINT
f3write $MOUNTPOINT
umount $MOUNTPOINT
mount $part $MOUNTPOINT
f3read $MOUNTPOINT
# Done. Unmount
umount $MOUNTPOINT
This script is run with sdcard_test.sh > cardname.log for each of the microSD card tested.
As the comments already explain, it does three things:
- Performs a destructive test with f3probe
- Identifies the first partition on the card and formats it to FAT32
- Since now we're sure the card is empty, it runs f3write and f3read to verify the whole capacity of the device
The umount - mount incantations before f3read are needed to force-flush the filesystem cache. This forces Linux to re-read from the device directly to make sure we are verifying the actual data written.
The procedure is thorough and takes 10-15 minutes for each SD card. However, it ensures that I'll also catch broken or failing flash chips. The part taking most of the time is the execution of f3write and f3read . This tests are needed because apparently, f3probe alone is not sufficient to tell for sure if a card is not fake. At first I was confused, so I opened an issue on the f3 repository [8] that led to a great explanation on this matter by the f3 author himself.
Test Results
Enough talking here is a table with the results:
SD card | Capacity | Verdict | Write Speed [MB/s] | Read Speed [MB/s] |
---|---|---|---|---|
Banoi_roox | 7.44 GB | PASS | 8.37 | 17.14 |
eb-flash | 3.69 GB | PASS | 3.9 | 18.34 |
miomg | 14.88 GB | PASS | 9.01 | 18.47 |
ouio | 7.5 GB | FAIL | - | - |
Raspberry Pi | 14.75 GB | PASS | 5.91 | 18.4 |
shandian | 7.5 GB | PASS | 4.51 | 16.21 |
To compare the SD cards against each other, I calculated two figures of merit:
- the speed score is the product of the read and write speeds in MB/s
- the overall score which is the speed score times the capacity in GB
The results are summarized in the following table (ordered by overall score). I have removed the OUIO SD card since it did not pass the test.
SD card | Speed Score | Overall Score |
---|---|---|
miomg | 166.4 | 2476.3 |
Raspberry Pi | 108.7 | 1604 |
Banoi_roox | 143.5 | 1067.4 |
shandian | 73.1 | 548.3 |
eb-flash | 71.5 | 263.9 |
All in all, the best card seems to be the miomg one. It is the fastest of the lot and holds 16 GB of data. For the second prize I'd pick the Banoi_roox SD card which, even though is ranked third, it is faster than the stock Raspberry Pi SD. However, I see what the Raspberry Pi Foundation did here. Application responsiveness is tied to the read speed and their SD card heavily favors reading compared to writing. Keep in mind though that the Banoi_roox is almost twice as fast in writing and its read speed is roughly 7% less than the rpi card. I did not test random IOPS while reading and writing because a firewall/gateway is not a desktop computer so I do not really care about application responsiveness.
Conclusion
It seems common internet knowledge that fake and/or cheap SD cards from china are bad. By betting on smaller-size cards you can increase your chances to purchase a working card. This is based on the assumption that the higher-capacity cards are just the same as the smaller size ones reporting to the OS a fake capacity. To test this assumption, I bought a few 8-16 GB cards and put them through a test script that reads and writes test patterns on the flash to make sure it's working as expected.
From my test results, I witnessed that 3/4 cards were actually working and reported the correct capacity. One of those was even faster than an official Raspberry Pi SD card of the same size. Read/write performance of the other cards was as expected, considering the purchase price (~2-3 $ each).
I can now provide an answer to the questions:
- How bad are cheap small-size microSD cards? Not that bad actually, 25% bad I'd say ;).
- Can I trust such cards? For niche applications I'd say yes, provided that they are thoroughly tested before use.
- Will I do it again? Of course. It's worth it and now that I'm confident about the script, testing is not time consuming and requires minimal manual interaction.
P.S. I won't trust those SD cards with my family photos anyway.
P.P.S. I received full refund for the broken OUIO card. Always ask for a refund!