How do I figure out the brand and type of an SD-card remotely on the commandline via SSH? I so far tried:

  • fdisk -l /dev/mmcblk0
  • gdisk -l /dev/mmcblk0
  • dmesg | fgrep -i mmc (the boot entries were already rotated out of the ring buffer)
  • zfgrep -i mmc /var/log/syslog* /var/log/kern.log*
  • smartctl --info /dev/mmcblk0 (resulted in /dev/mmcblk0: Unable to detect device type)
  • lshw -C storage
  • file -s /dev/mmcblk0
  • cfdisk /dev/mmcblk0
  • cgdisk /dev/mmcblk0

Context: After having had to replace SD-cards in two of a bunch of remotely deployed Raspberry Pis (LoRaWAN gateways) which were not initially installed by myself, I want to figure out if the remaining, still running Pis have the same type of SD-card or by chance a different brand and/or type.

A bit of information I figured out, but I didn't find a mapping to brand or type, i.e. something that I can correlate with what I can see from the outside of the two broken SD-cards:

# cat /sys/block/mmcblk0/device/name 

# cat /sys/block/mmcblk0/device/name 

# cat /sys/block/mmcblk0/device/name 

# cat /sys/block/mmcblk0/device/name 

So they seem to be different (the numbers before G—where present—correlate with the size), but are they also different manufacturers/series?

At least this always looks the same on all of the four Raspberry Pis from which the four different name contents above were taken:

# cat /sys/block/mmcblk0/device/oemid 

0x5344 from the oemid means SD as in SanDisk. Type is probably not easy; I guess it is their internal name. Read more at https://www.cameramemoryspeed.com/sd-memory-card-faq/reading-sd-card-cid-serial-psn-internal-numbers/

  • Thanks a lot for that link. That even explains some more of the information I can find in /sys/block/mmcblk0/device/ on Linux. And indeed. hex 0x5344 is "SD" in ASCII. So they're all from SanDisk, but all different models. Now I just need to find a table of there 5-character product names. Oh, and welcome to the site! Feb 23 at 6:44
  • 1
    @AxelBeckert: Some more information is here, and in the "appendix" which follows. There is more data in /sys/block/mmcblk0/device/csd, but neither blog helps decode it.
    – Seamus
    Feb 24 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.