Finding a unique identifier for SD cards

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


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.

Tags:

Sd Card