Colleen Beamer wrote:
Hi,

I have a situation that, before, kind of bugged me but I was able to
deal with it.  However, now I've added another wrinkle to the situation.

I have a usb external hard drive attached to my computer.  It's an
Iomega and has a power switch.  In fstab it is /dev/sdc1 and /dev/sdc2
because I've configured it to have two ext3 partitions.  If the drive is
not powered on when I boot and then, I turn it on, I have to reboot to
get fstab to recognize it.  That has always sort of irked me, but I
dealt with it because the drive holds only my music files.

The wrinkle is that my son bought me a usbstick.  I can mount it just
fine.  However, if my usb external hard drive is not powered on on boot,
the stick is recognized at sdc1.  If the usb drive is powered on then,
the stick is recognized as sdd1.  So, this means that if I want to use
one or the other or both, I keep having to change fstab.  Is there a way
I can set the device to always be the same - i.e.  I always want the usb
external drive to be sdc1 and sdc2 and the usb stick to be sdd1.

I know!  I only want the world.  If there isn't a way that this can be
done, then I'll live with the situation.  It's not earth shattering!

Thanks in advance.

Regards,

Colleen


This is actually semi-easy. What you need is udev rules for each of the devices, so what you need first is some info. Do an 'emerge usbutils' then run 'lsusb -v'. This will output a bunch of info about the currently connected USB devices. Then, look for the Vendor and Model strings, and put them into a udev rule in /etc/udev/rules.d/. For example, my udev rules include an entry like this for my iPod:

BUS=="scsi", SYSFS{vendor}=="Apple*", SYSFS{model}=="iPod*", \ KERNEL=="sd?2", NAME="%k", SYMLINK+="ipod"

This tells udev that it should look for a device on a SCSI bus (which covers USB as well) with a vendor string starting with Apple and a model string starting with iPod, that would normally have a device name of /dev/sd{something}2. It then tells udev to create a symlink to this device at /dev/ipod (the SYMLINK+= part).

After that, just change your /etc/fstab to reflect the device symlinks that you created, and voila! You still have to mount them manually, though, unless something new's come along I'm not aware of.

This is a really simplified explanation of udev, so for a more advanced guide, Gentoo provides some excellent documentation at:

http://gentoo-wiki.com/UDEV

Good luck! And remember: either hotplug your devices or run 'udevstart' to test your rules!
--
[EMAIL PROTECTED] mailing list

Reply via email to