# udev, usb-storage and fixed devices. Any Howto available?

## pactoo

Hello,

I do have 3 different, external USB storage devices and would like to assign each of those a fixed device node. Preferably something other than /dev/sdx, to avoid interferance with a changeable sata drive, so that I can assign a unique mountpoint to each in /etc/fstab.

Like: USB HD will alway be /dev/uda

The USB-Stick will always be /dev/udb, even if the USB-HD is not plugged in

The card reader which reads the SD card will alway be /dev/udc

Is that possible with udev ? I heared rumors, since having an arbitrary device getting /dev/sda, kind of first come, first serve, is, to be polite, really unlucky.

----------

## jeremah

Hi,

Have you looked at the guide here:

http://www.reactivated.net/udevrules.php

You'll need to do a bit of digging around to get it set up right but it should cover what you want to do.

----------

## mottegre

here's what i did for my removable usb drive

write a udev rule specific to the drive, in /etc/udev/rules.d/10-local.rules (create the file if it doesn't exist)

for example, by replacing the serial number by the one corresponding to your device

BUS="usb", KERNEL="sd*", SYSFS{serial}="200402023063", NAME="%k", SYMLINK="usbhd%n"

this will link /dev/usbhd to dev/sd_ , along with all the partitions (/dev/usbhd1 to /dev/sd_1, etc...)

----------

## pactoo

@mottegre: Thanks very much. However, where did you get the serial from ?

@jeremah: Nice link. Thanks. In case I ever get reborn in a more intelligent lifeform I promise will follow what I have read there  :Wink: 

----------

## mottegre

that's also in the link jeremah gave you.

section "Identifying devices through SYSFS files"

----------

## pactoo

Thanks. Worked, even though I am far away from understanding it. Wasn't exactly what I was looking for as I wanted to avoid /dev/sda beeing created at all by usb devices and /dev/uda being created instead as opposed to simply symlink, as this may still interfere with other scsi discs.

So if I boot with an usb stick which gets for various reasons mounted before the scsi discs it still messes up those devicenames of the harddrives. Gets interesting when those scsi discs are run in a softraid and which then consists of /dev/sda2-5 instead of sda1-4, as it was created. 

devfs was way superior here with its absolute adressing. Thats was what I wanted to archive, absolute adressing, too, but seems impossible with udev.

----------

## kael

I usually use the gentoo-nofb kernel on the LiveCD. When doing this, not only is /dev/sr0 not created, but neither is /dev/ram0.

Following the same directions with an additional:

```
mknod /dev/ram0 b 1 0
```

does the job.

----------

## AdShea

You could try making a udev rule to symlink your soft-RAID devices somewhere else too.  The problem is that the SCSI drivers are used by a huge number of disk devices (USB, IEEE1394, SoftRAID, etc.) Try setting it to /dev/sraid%n  use the same methods you used to determine the ID's as for the USB key.

----------

