Finding attributes of mounted SD card

My SD card is automounted fine as /dev/sdb:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  1024M  0 rom  
sda      8:0    0    80G  0 disk 
├─sda1   8:1    0    78G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0     2G  0 part [SWAP]
sr1     11:1    1  1024M  0 rom  
sdb      8:16   1   7.4G  0 disk 
├─sdb1   8:17   1    56M  0 part /media/boot
└─sdb2   8:18   1   2.7G  0 part /media/af599925-1134-4b6e-8883-fb6a99cd58f1

In dmesg:

[ 1206.970596] sd 3:0:0:0: [sdb] Attached SCSI removable disk

I would like to know a few attributes - serial #, manufacturer id, etc. that I thought would be in /sys/class. I have searched /sys/class/scsi_disk/3:0:0:0/ without any luck.

Where would I find this information? I am using the latest version of Arch-linux.


Solution 1:

The proper way to do this, in Arch Linux but by now in all systems which use udev, is the command:

  sudo udevadm info -a -n /dev/sdb

in your case.

Edit:

A reply to your comment: I believe you are mistaken. The class is a view of a device which is independent of the low-level implementation details. The classic example is a disk. You may of course have a SCSI disk or an ATA disk, but, at the class level, they are the same thing. The idea of the class is to allow users to build userspace code which is independent of how they are connected to the network, how they work, which device driver they use, and so on. In a way, the class is the highest level of abstraction available as a model for devices.

Thus you are wrong in searching for such details as your SD card vendor (which, by the way, should be in /sys/class/mmc_host, if anything at all) within /sys/class.

Solution 2:

The exact layout is driver dependent, but try searching /sys for some MMC (SD) specific keywords. Below is from an ARM-based embedded system:

$ find /sys -name "oemid"
/sys/class/mmc_host/mmc0/mmc0:aaaa/oemid
$ find /sys -name "cid"
/sys/class/mmc_host/mmc0/mmc0:aaaa/cid
$ find /sys -name "csd"
/sys/class/mmc_host/mmc0/mmc0:aaaa/csd

Bunnie's blog entry on SD card shenanigans is a good place to start back-tracking what those ID numbers mean.