Udev provides a means of dynamically creating devices in /dev
Udev provides a means of dynamically creating devices in /dev.
Kernnel 2.6 and above. However, I have also had this working on 2.4.20
Installation and configuration
To install, under Debian distribution, type:
apt-get install udev
This also requires the legacy hotplug but this is slowly being removed.
udev establishes a directory /etc/udev. Within this are the configration files and rules for udev. The configuration file udev.conf can be left as installed. The rules (udev.rules and directory rules.d) will be left to the user to edit depending on the devices being used. The rules detail what is to happen on detection of certain hardware types. Descriptions can use manufacturers names or device code, pretty much anything really and wild cards can also be used. This can then indicate what kernel modules are required, permissions and launched scripts.
Another directory, /etc/dev.d is also created. This contains directorys pertaining to the type of device, say block for a scsi based device. This directory contains a file (extension of .dev) which is the script that is auto run on detection of the device. This script will perform actions depending on if the device has been 'added' or 'removed'.
For 'hotplug' USB devices, installed usbmount:
apt-get install usbmount
This installs a udev script at /etc/dev.d/block/usbmount.dev and also a bash script in /usr/sbin. A configuration file is used to determine where the media is to be mounted, defaults to /media/usb1..9. udev will auto-detect the drive and the usbmount script will mount each detected partition at /media/usb1, /media/usb2, ... On removal, the drive will be un-mounted and the device node removed.