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 

2 Answers 2


Some data, as you mentioned, is in /sys/block/mmcblk0/device. There's a tool called mmc in the mmc-utils package that can read/decode several of the values in that directory. For instance:

$ mmc csd read /sys/block/mmcblk0/device
type: 'SD'
card classes: 10 switch, 8 application specific, 4 block write, 2 block read, 0 basic, 
capacity: 14.76Gbyte (15847653376 bytes, 30952448 sectors, 512 bytes each)

$ mmc scr read /sys/block/mmcblk0/device
type: 'SD'
version: SD 3.0x
bus widths: 4bit, 1bit, 

$ mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'SanDisk' 'SD'
product: 'SS16G' 8.0
serial: 0x95554991
manfacturing date: 2017 jun

You can also pass -v to any of those commands to get lower-level details on how the data was parsed.

Unfortunately, I haven't figured out if any of the other functionality works on regular SD/MMC cards, or just eMMC. e.g. I can't get sudo mmc extcsd read /dev/mmcblk0 to work on my Pi. But, with your mention of sysfs I was able to get the tool to parse some of the other data!

  • Indeed, thanks! I guess this is the closest we come with this topic. Thanks again! Commented Mar 28, 2022 at 23:54
  • sudo apt install mmc-utils -y && mmc cid read /sys/block/mmcblk0/device did it for me, thanks Commented Jul 16, 2022 at 21:07

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! Commented Feb 23, 2021 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
    Commented Feb 24, 2021 at 23:37
  • 1
    You can use the mmc tool from mmc-utils to decode the csd data: mmc csd read /sys/block/mmcblk0/device gives something like: type: 'SD' card classes: 10 switch, 8 application specific, 4 block write, 2 block read, 0 basic, capacity: 14.76Gbyte (15847653376 bytes, 30952448 sectors, 512 bytes each) Commented Mar 28, 2022 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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