GNU/Linux Desktop Survival Guide by Graham Williams |
|||||
Using UDEV |
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) |