[KLUG Members] Slick use for udev rules!

Robert V. Kanaley rvk at agdia.com
Fri Feb 25 11:55:06 EST 2005


Greetings all,

This morning I learned that udev has added some really slick capabilities to
our increasingly "plug it in and expect to use it" world.

The link below explains how to automate the persistent mounting of removable
devices to custom named link points (if you are using SYSFS and udev in 2.6
kernels). If you don't think this applies to you, read the example below
that is excerpted from the following link:

http://www.reactivated.net/writing_udev_rules.html

"Say that I have two printers - a HP laser printer and an Epson inkjet. When
they are both plugged in and on, I have /dev/lp0 and /dev/lp1. How do I know
which node refers to which printer? There is no easy way. The first printer
that got connected was assigned name "lp0", and the second "lp1". Plugging
in my printers in a different order would swap the names here, and that
would mess up my scripts that always expect my HP laser printer to be lp1.

However, if my HP laser printer got named lp_hp (as well as lpX) and my
other printer got named lp_epson (as well as lpY), then my scripts could
just refer to those names. udev magic can control this and ensure that these
persistent names always point to the device that I intended.

For external mass-storage devices (e.g. usb hard disks), persistent naming
is very helpful in that it allows you to hardcode accurate device paths into
your /etc/fstab."

I will be writing some udev rules for my SuSE 9.2 Pro box to resolve some
issues with a USB multi-card CF reader at home. The multiple card
capabilities means potentially confusing mass-storage mount points for
different cards, without a little udev magic.

I hope someone besides me finds this a useful Howto.

Regards,

Bob

Robert V. Kanaley
Manager Information Systems
Agdia, Inc.
rvk at agdia.com
http://www.agdia.com



More information about the Members mailing list