Go to TogaWare.com Home Page.
GNU/Linux Desktop Survival Guide
by Graham Williams
Google

Using UDEV


Debian Packages: udev hotplug

A problem that plagued earlier versions of the GNU/Linux kernel was that each time a USB device (and other devices) was connected a different mount point would be assigned. This issue was addressed in the 2.6 kernels using udev with hotplug. With udev, naming rules (e.g., in /etc/udev/rules.d/local.rules) are used to provide stable names for use in /etc/fstab. Udev uses information exported by the kernel drivers to the sysfs filesystem (usually mounted on /sys) to identify specific devices and to then associate them with specific names in /dev.

The key to using udev is with the rules that are defined to identify and distinguish the different USB devices that may be connected. A tutorial for writing udev rules is available from http://www.reactivated.net/udevrules.php.

The first step is to identify the USB device in some way. The udevinfo command can be used to identify a device path, which can then be used to identify information about the device on that path. For example, to identify a specific Flash Memory device which is recognised in GNU/Linux as a SCSI device, connect the device and run the command:

  $ udevinfo -a -p $(udevinfo -q path -n /dev/sdc)

The /dev/sdc path here is whatever the dmesg command identifies. Select some identifying piece of information, like the product identifier (the line that starts with SYSFS{product}=), and add that to /etc/udev/rules.d/local.rules (each rule must be on a single line).


Subsections

Copyright © 1995-2014 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware.