LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   persistent name of SD card (http://www.linuxquestions.org/questions/linux-newbie-8/persistent-name-of-sd-card-948991/)

sluge 06-07-2012 04:50 AM

persistent name of SD card
 
Hello!
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?

PS:
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

Quote:

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. http://ubuntuforums.org/showthread.php?t=168221


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:
Code:

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

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.:
Code:

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 11:43 AM.