2

I'm using Ubuntu 16.04 and I'm trying to get serial number and oemid of SD card. I have found an instruction here, but on my current system I cannot find it.

Previously I was using Ubuntu 15.10 and I'm pretty sure I was able to access proper place in /sys/ to get this information, but now I cannot find it anymore.

After inserting a SD card it is automounted and I can access files on it, but find /sys/ -name oemid shows nothing.

Can you help me find out what is missing/why files in /sys/ does not show up?

(I have Ubuntu 16.04 upgraded from 15.10)

6
  • If you go to gnome disks, you should see a field called Device. What is the device name? (Ex: /dev/sdb)
    – anonymous2
    Jul 4, 2016 at 13:20
  • It is /dev/sdb and here I can see the serial number but I wanted to access it from the C application so I does not resolve my problem.
    – lewiatan
    Jul 4, 2016 at 13:26
  • 1
    Ok, so you can get it from running the command sudo udevadm info -a -n /dev/sdb.
    – anonymous2
    Jul 4, 2016 at 13:29
  • udevadm info works. Thank you. Do you have any idea what happend to the file in sys ?
    – lewiatan
    Jul 4, 2016 at 13:32
  • Not sure. It could be a change from 15.10 to 16.04, like you suggested.
    – anonymous2
    Jul 4, 2016 at 13:39

3 Answers 3

4

First, find your device name. (/dev/sdb, /dev/sdc, etc.)

Then, run the following command:

sudo udevadm info -a -n /dev/xxx

...replacing xxx with the correct letters.

1
  • SD/microSD card can be /dev/mmcblk0.
    – pbies
    Feb 14, 2023 at 17:24
2

hdparm should be able to print the serial number

sudo hdparm -i /dev/sdb
7
  • I only get : $ sudo hdparm -i /dev/sdb /dev/sdb: SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 HDIO_GET_IDENTITY failed: Invalid argument
    – lewiatan
    Jul 4, 2016 at 13:31
  • It's a capital i.
    – anonymous2
    Jul 4, 2016 at 13:39
  • either should work but not it seems for this device, not all sdcard readers make all the fields available.
    – Amias
    Jul 4, 2016 at 14:00
  • On my system only in capital works.
    – anonymous2
    Jul 4, 2016 at 14:02
  • small i is less verbose than capital I
    – Amias
    Jul 4, 2016 at 14:04
1

To view the CID, the command is cat /sys/block/mmcblk0/device/cid (the exact location may be different)

This will not work through a USB card reader because the command to retrieve the card information is intercepted and not understood by card readers. Not all computers with built-in card slots will work, some internal card readers are connected through a USB bus.

Source: https://www.cameramemoryspeed.com/sd-memory-card-faq/reading-sd-card-cid-serial-psn-internal-numbers/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .