Jan 22, 2009 Is there a way to read the CID of a micro-SD card Questions and Answers. Xda-developers General discussion Questions and Answers Is there a way to read the CID of a micro-SD card by blkmagikca. What he and me would need is the 'PSN' which is written in the CID Register of a microSD-Card; the Product serial number PSN (32bits. Serial number of the SD card, so just backing up the data isn't enough. How to read the SD Card ID number? Palm OS and Windows Mobile OS devices are able to read the SD card ID. This section describes the Secure Digital (SD) card technology to help you develop a SD card driver that interacts with a SD bus driver. Serial number /downloading code. Is there a way to read the CID of a micro-SD card Questions and Answers. In the CID Register of a microSD-Card; the Product serial number PSN (32bits binary. The serial number and MAC address will follow the Pi, not the SD Card. Plugging a cloned SD card into a different Pi will change the serial number and the MAC address. If you think about it, any new Pi with a new image from the download link above will be a clone anyway.
I have dozens of SD cards that I need to keep track of for a project. Right now, they each have a number physically written with permanent marker on the outside. This is OK, but I want to see if there is something unique that's built into each SD card that I can record. So far I am aware of:
- The SD card's CID, which usually (not always???) includes an unique serial number. I can't find a straightforward way to read this off an SD card in Fedora 21. Some pages say that unless you have a card reader directly connected to the PCI bus (and not via USB), you can't see the CID.
- Volume/partition serial number. This might work but I understand that this changes every time the card is reformatted, which is something we do from time to time. So not a good option.
- Just labelling the SD card volume with my own unique naming system. This is too easy to change, and I might as well just stick with writing the numbers on the outside.
So, I guess my questions are:
Every SD card that is made must have a CID in order to interface with another device. The CID is a special identifying code that is unique to each card, working in the same fashion as a serial number.
- Is there a way to reliable read the CID off my SD cards to get serial numbers via a USB card reader in Fedora 21 or other GNU/Linux distributions?
- If not, are there other ways of using existing unique identifiers in an SD card or another system for uniquely identifying SD cards?
2 Answers
blkid(8) is probably what you're looking for. It will give the UUID of each device.
For vfat, can set UUID using mtools application mlabel(1).
For ext2, ext3, and ext4, e2label(8) can be used to set the UUID.
So if you reformat from time to time, just set the UUID to the same as it was before if needed.
Can't speak for other card readers, but the ones I've used via a USB port pass through the UUID of the SD card.
Serial Number Windows Xp
Based on @humanityAndpeace comment, Looking for CID
could be a solution, but it seems that you cannot get it from all sd cards. At least it is the case for one I tested. See more documentation here.
The idea is to get infos from /sys/block/<yourBlockDevice>/device/cid
Note: you can read <yourBlockDevice>
from sudo dmesg
after plug in