-   Linux - Newbie (
-   -   persistent name of SD card (

sluge 06-07-2012 04:50 AM

persistent name of SD card
SD memory card is inserted to internal slot of my server. Sometimes when I boot, this card is /dev/sda, sometimes it's /dev/sdi. Is any way to completly define name of usb card?

It will be great if all internal hard drives would be sda, sdb, ... sdh, and any usb devices would be sdi(SD card), sdj(my USB key) and others...

Didier Spaier 06-07-2012 05:03 AM


Originally Posted by sluge (Post 4697685)
Is any way to completly define name of usb card?.

Yes with udev rules but that depend on the distribution & version used.
So please tell us which they are.

jefro 06-07-2012 03:43 PM

The problem is using sd(x) as a way to identify it.

As Didier Spaier suggests, a udev rule may work.
Here is an example.

It is possible that you could change how usb interacts with scsi mass storage maybe and change how it reports. Never looked into that. change the way it s called from sd to su or such.

Didier Spaier 06-07-2012 04:08 PM

Second thought I think that there is another (and easier) way.

Plug in your SD card, check how it is identified; let's suppose it's /dev/sdx

Then issue following command:

blkid /dev/sdx
I don't have a SD card at hand but I just tried with an USB key and got this:

bash-4.1$ blkid /dev/sdb1
/dev/sdb1: UUID="4E95-B2D0" TYPE="vfat"

All you have to do is add a line to your /etc/fstab, e.g.:

UUID=4E95-B2D0 /media/USBkey1 vfat noauto,user,rw 0 0
Of course I would need to "mkdir media/USBkey1" first.

Then I can plug in my USB key and type "mount /media/USBkey1" or have it automatically mounted.

I'm not 100% sure this works for a SD card but that's worth trying ;)

All times are GMT -5. The time now is 02:02 PM.