Detect Counterfeit SD Cards - iot-root/garden-of-eden GitHub Wiki
Gardyn apparently bought a batch of counterfeit SD Cards, so when my Gardyn failed, I was alerted to this possibility. Physical inspection of the card inside the Raspberry Pi Zero W inside the gardyn's lid didn't reveal anything suspect, as it often does, though my Gardyn's operating system had apparently corrupted, and was kernel panicking on boot. There exist applications for writing to the card's full memory based on its reported size, but this also destroys all data on the card, and in my case, results were inconclusive. Here's how you can probe the card to determine if it's causing — or may cause in the future — issues from inside the current OS, without risking any data if the card is healthy.
Disclaimer
You're doing this entirely at your own risk. You take on full responsibility for anything including, but not limited to: any and all lost data, lost original Gardyn project files, damaged Gardyn equipment, and anything else at all. If the moon falls on your house resultant from your tinkering or following this guide, it's fully and completely on your shoulders.
Windows
I have yet to find an application that actually does this on Windows, sorry! If you know of one, feel free to let me know on the Discord, and I'll check it out and update this article if relevant!
Raspberry Pi
🛈 Your Gardyn's SD Card must be bootable at this point. If it's not, consider following the From-Scratch Installation Guide.
Requirements
- A bootable Gardyn
- An
sshclient
OR
- A bootable Gardyn SD Card
- A Raspberry Pi Zero W or Zero 2 W, matching what is in your Gardyn (you may take out and use the one in your Gardyn)
- A monitor
- An HDMI setip that can do Mini HDMI -> above monitor (Adapter: HDMI -> Mini HDMI)
- A keyboard with a USB Micro-B plug (Adapters: A -> C A -> Micro-B)
- A power supply capable of delivering at least 1.2A, or a USB A <-> Micro-B cable to plug the device into your computer
🛈 Note that a Micro-B USB dock could be substituted for some of the above devices depending on configuration.
Procedure
Once you're logged into the gardyn, run the below commands to set up the utilities we need, create our checker script, and change its mode to executable:
- This command installs our pre-requisite for extended info parsing,
mmc-utils:
sudo apt-get install mmc-utils
- This command creates the file
getcardinfo.shin the directory you're currently in, and makes it executable:
curl -L -o "getcardinfo.sh" "https://gist.githubusercontent.com/mpql/fbf8b27129b11ac3adb971b2a9471b37/raw" && chmod 700 "getcardinfo.sh"
- And finally, this command executes our script:
"./getcardinfo.sh"
In my case, the card that came with my Gardyn looked like a SanDisk. I compared it to a known-legitimate SanDisk card, and got differing results, indicating my card was counterfeit. Here were my results:
Legitimate SanDisk
This is what a legitimate card should look like. The 0x5344 is important, as that's the SanDisk manufacturer OEM ID.
$ ./getcardinfo.sh
oemid: 0x5344
manid: 0x000003
type: 'SD'
manufacturer: 'SanDisk' 'SD'
product: 'SC16G' 8.0
serial: 0x42668356
manufacturing date: 2018 oct
type: 'SD'
card classes: 10 switch, 8 application specific, 7 lock card, 5 erase, 4 block write, 2 block read, 0 basic,
capacity: 14.84Gbyte (15931539456 bytes, 31116288 sectors, 512 bytes each)
type: 'SD'
version: SD 3.0x
bus widths: 4bit, 1bit,
Counterfeit SanDisk
Here's the counterfeit card that came with my Gardyn 3.0:
$ ./getcardinfo.sh
OEM ID: 0x3432
type: 'SD'
card classes: 10 switch, 8 application specific, 7 lock card, 5 erase, 4 block write, 2 block read, 0 basic,
capacity: 14.88Gbyte (15978201088 bytes, 31207424 sectors, 512 bytes each)
type: 'SD'
version: SD 3.0x
bus widths: 4bit, 1bit,
type: 'SD'
manufacturer: 'Unlisted' '42'
product: 'SD16G' 2.0
serial: 0x0000101b
manufacturing date: 2022 sep
Note the differing OEM ID, the suspect manufacturer "'Unlisted' '42'", and and the very low (lots of zeroes) serial in the counterfeit card.
Run the script for yourself, and feel free to compare to known good values. You can check your card against its manufacturer printed on the outside of the card's plastic with the reference table below.
Anyhow, if your card is counterfeit, back up an image of it with e.g. dd on Linux or Rufus on Windows, and if you experience a failure, you can clone that image to a known-good SD card. You can also see the From-Scratch Installation Guide to start with garden-of-eden from a known stable OS on a separate, genuine card.
Reference
For your convenience, find some known good values for manufacturers I could find the info on:
Likely Genuine
| Manufacturer Name | OEM ID | Mfr. ID |
|---|---|---|
| AData | 0x4144 (AD) | 0x00001d |
| Kingston | 0x5449 (TI) | 0x00009f |
| Lexar | 0x4245 (BE) | 0x000028 |
| Panasonic | 0x5041 (PA) | 0x000001 |
| Phison | 0x5048 (PH) | 0x000027 |
| Samsung | 0x534d (SM) | 0x00001b |
| SanDisk | 0x5344 (SD) | 0x000003 |
| Silicon Power | 0x5350 (SP) | 0x000031 |
| Strontium | 0x5446 (TF) | 0x000084 |
| Toshiba | 0x544d (TM) | 0x000002 |
| Transcend | 0x4a45 (JE) | 0x000074 |
| Transcend | 0x004a (J) | 0x000074 |
Possibly Genuine?
| Manufacturer Name | OEM ID | Mfr. ID |
|---|---|---|
| Patriot (?) | OoB (��) | 0x000076 |
| Sony (?) | 0x4a54 (JT) | 0x000082 |
Suspect / Counterfeit
| Manufacturer Name | OEM ID | Mfr. ID |
|---|---|---|
| Unlisted | 0x3432 (42) | 0x000041 |
| 0x4245 (BE) | 0x00009c | |
| 0x534f (SO) | 0x00009c |
🛈 Note that there are brands whose cards are made by other manufacturers, but feature their branding. The important part is that the OEM ID and the Manufacturer ID match. Below are cards found to have matching OEM IDs and Manufacturer IDs with mis-matched brands are:
- AgfaPhoto
- Delkin
- Gobe
- Integral
- Lexar
- Micro Center
- Patriot
- PNY
- Polaroid
- ProGrade
- Sony
- Verbatim
If you have card data not listed, post your results in the discord, and we'll try to help you figure out its status!
– mpql / @mpql on Discord