Skip to contentSkip to conversation

Problem with usb-storage and /dev/sd?

DISCUSSION DervishD 3 participants 5 messages Aug 10, 2005 – Aug 11, 2005

lore
Share & tools
lore

DervishD

author
#0 lore raw

Hi all :)

If I plug my MP3 player (USB), the usb-storage module assigns it
device /dev/sda, which is right because I have it configured as such in my /etc/fstab. Well, another day, another boot and I plug my USB memory stick, and usb-storage assigns it device /dev/sda, quite cool because I have it configured as such in my /etc/fstab, too.

The problem is that if I plug my USB memory, unplug it and plug
my MP3 player, it gets /dev/sdb this time, not /dev/sda. The mess is even greater if I plug my card reader, which has four LUN's...

I'm not using hotplug currently so... how can I make the USB
subsystem to assign always the same /dev/sd? entry to my USB Mass storage devices? For example, I will assign /dev/sda to my MP3 player, no matter if it is the first or the last USB gadget plugged, etc. I would like fixed assignations, not the current way of 'first item plugged gets /dev/sda and you have to remove the module if you want the next item to be placed in /dev/sda'. I've googled a bit without any success :(

Thanks a lot in advance :)

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
#1 lore raw
Quoted 9 lines · DervishD

If I plug my MP3 player (USB), the usb-storage module assigns it
device /dev/sda, which is right because I have it configured as such in my /etc/fstab. Well, another day, another boot and I plug my USB memory stick, and usb-storage assigns it device /dev/sda, quite cool because I have it configured as such in my /etc/fstab, too.

The problem is that if I plug my USB memory, unplug it and plug
my MP3 player, it gets /dev/sdb this time, not /dev/sda. The mess is even greater if I plug my card reader, which has four LUN's...

That's what udev is for. Example rule to give my memory stick
persistent name:

BUS="usb", SYSFS_serial="5B4B06010122", NAME="pendriveZDZ%n", GROUP="floppy", MODE="0662", RUN+= "/sbin/udev_run_hotplugd"

Go figure how to udev-enable your distribution.

Signature · 2 lines
Tomasz Torcz               "Never underestimate the bandwidth of a station
[email protected]    wagon filled with backup tapes." -- Jim Gray
author
#2 lore raw

Hi Tomasz :)

* Tomasz Torcz <[email protected]> dixit:

Quoted 5 lines · DervishD
Quoted 3 lines

The problem is that if I plug my USB memory, unplug it and plug
my MP3 player, it gets /dev/sdb this time, not /dev/sda. The mess is even greater if I plug my card reader, which has four LUN's...

That's what udev is for.

I know, but I use a 2.4.x kernel (which I didn't mention in my
original message, sorry O:)), and udev needs a 2.6.x kernel, am I wrong?

Quoted 1 line

Go figure how to udev-enable your distribution.

I have a do-it-yourself Linux box, so setting up udev is not much
of a problem as long as the kernel supports it. If udev doesn't use any kernel magic (that is, it only uses /sbin/hotplug), how the heck does it know which /dev/sd? the *kernel* assigned to my recently plugged USB device? How can it influenciate which device is assigned *by the kernel*? I assume that it needs some magic from the kernel and so it only works for 2.6.x :???? In fact, if it uses sysfs, it still needs a 2.6.x for that, am I wrong?

I'll take a look anyway, thanks a lot for your message and help :)

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
#3 lore raw
Quoted 4 lines · DervishD

Hi Tomasz :)

* Tomasz Torcz <[email protected]> dixit:

Quoted 1 line · DervishD
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

The problem is that if I plug my USB memory, unplug it and plug
my MP3 player, it gets /dev/sdb this time, not /dev/sda. The mess is even greater if I plug my card reader, which has four LUN's...

That's what udev is for.

I know, but I use a 2.4.x kernel (which I didn't mention in my
original message, sorry O:)), and udev needs a 2.6.x kernel, am I wrong?

That is correct, udev needs 2.6. So, with 2.4 you are on your own here, sorry.

thanks,

greg k-h

author
#4 lore raw

Hi Greg :)

* Greg KH <[email protected]> dixit:

Quoted 8 lines · DervishD
Quoted 5 lines

* Tomasz Torcz <[email protected]> dixit:

Quoted 1 line

That's what udev is for.

I know, but I use a 2.4.x kernel (which I didn't mention in my
original message, sorry O:)), and udev needs a 2.6.x kernel, am I wrong?

That is correct, udev needs 2.6. So, with 2.4 you are on your own here, sorry.

Any way of forcing usb-storage to assign a particular device to a
recently plugged USB gadget? Wait a minute: hotplug events *include* the name of the assigned device, am I wrong? Then I can deal with the issue...

I'll post my solution to the list, if any ;)

Thanks :)

Raúl Núñez de Arenas Coronado

Signature · 3 lines
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...