Using UDEV 

http://linux.togaware.com/survivor/Using_UDEV.html http://www.linuxtopia.org/online_books/linux_beginner_books/debian_linux_desktop_survival_guide/Using_UDEV.shtml

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 (each rule must be on a single line).

Subsections

Using udev 

http://linuxbasics.org/tutorials/using/using_udev

Kernel 2.6 has begun the use of udev for handling devices for making those files in /dev that previous kernels just created permanently. udev creates these files as needed. Setting up udev so that when you plug in a palm and then have /dev/pilot as the assigned device is not difficult. I got the information on how to do this at http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimerMisc.html. I am using Debian Sarge with 2.6.8-2-386 kernel.

General procedure

Persistent block device naming 

From ArchWiki http://wiki.archlinux.org/index.php/Persistent_block_device_naming

This article describes how to use persistent names for your block devices. This has been made possible by the introduction of udev and has some advantages over bus-based naming.

Contents 

1 Why persistent naming?
2 Which name should I use?
    o 2.1 by-label
    o 2.2 by-uuid
    o 2.3 by-id and by-path
3 Enabling persistent naming
    o 3.1 In fstab
    o 3.2 In your boot manager

by-label 

All your partitions that have one are listed in the /dev/disk/by-label directory.

Enabling persistent naming in boot manager 

kernel /boot/vmlinuz26 root=/dev/disk/by-label/root vga=0x318 ro

or

kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/2d781b26-0285-421a-b9d0-d4a0d3b55680 vga=0x318 ro

Check the original wiki for all the prerequisites that have to be met.

documented on: 2007.01.04

Disk not listed in /dev/disk/by-uuid 

Newsgroups: gmane.linux.debian.user
Date: Sat, 1 Sep 2007
> I am having problems mounting one of my USB disks by
> its UUID. Mounting the drive as /dev/sdx# works
> flawlessly. As I am not sure how to approach the
> problem, here is some of the stuff that I have tried:
>
> blkid correctly lists the disk and corresponding info.
> /dev/disk/by-uuid does not list the UUID of the disk
> vol_id /dev/sdx# gives the error message /dev/sdx#:
> unknown volume type
> vol_id --type vfat /dev/sdx# results in vfat: error
> opening volume

what does 'ls -l /dev/disk/by-uuid/' and 'ls -l /dev/disk/by-id/' show? You can IIRC also use the by-id instead of by-uuid.

Kevin Mark @verizon.net

Disk not listed in /dev/disk/by-uuid 

I had the same problem when adding a new SCSI disk.

I found that the device did show up in /dev/disk/by-id

tomviolin @tomhansen.com

UDev urls 

http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html

Most helpful urls 

UDEV Primer 

http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html

  1. What is UDEV?

  2. Steps to Setting Up UDEV.

    1. Kernel configuration.

      • Kernel-2.6.13 and greater configuration.

      • Pre 2.6.13 Kernel configuration.

    2. Emerge Udev.

    3. Setup Hotplug.

    4. Sys folder.

    5. Fstab mounting.

    6. Update baselayout.

    7. Edit the scripts.

      • Newer Baselayout ( >=1.11.13-r1 ).

      • Baselayout ( >=1.8.6.13-r1 <=1.11.13-r1).

      • Old Baselayout ( <1.8.6.13-r1 )

    8. Console & Null devices.

    9. Nvidia drivers.

    10. Bootloader.

    11. Rebooting Results.

  3. Problem Devices.

  4. Snippet of How to Write UDEV Rules.

  5. Misc Devices: Palm Pilots, Flash Drive (Thumb, Pen,..)

  6. Links

UDEV micro howto 

http://www.planamente.ch/emidio/pages/linux_howto_udev.php

1. UDEV 

1.1. Introduction 

UDEV seems to replace DEVFS. Actualy, DEVFS is not really supported anymore.

1.2. Requirements 

Kernel 2.6 with udev support.

1.3. Installation 

Just call

apt-get install udev gnome-volume-manager

1.4. Configuration 

Add sysfs in fstab

none /sys sysfs defaults 0 0

and mount it

mount /sys

1.5. Device configuration 

Each device seems to be identified by a model and vendor. Here how to find out these values.

Plug in your USB device and get the device name:

tail -n 20 /var/log/message

You should find sda or sdb or something like this.

In the next steps, replace sda with what you have found before.

Call

udevinfo -q path -n /dev/sda
udevinfo -a -p /sys/block/sda | grep BUS
udevinfo -a -p /sys/block/sda | grep model
udevinfo -a -p /sys/block/sda | grep vendor

You should find something like:

BUS="scsi"
SYSFS{model}="..."
SYSFS{vendor}="Apacer  "

Add and entry in /etc/udev/udev.rules:

BUS="scsi", SYSFS{vendor}="Apacer  ", NAME="apacer%n", SYMLINK="%k"

Create directory for script to be called (replace apacer with your vendor name)

mkdir /etc/dev.d/apacer-1

and copy the following script in /etc/dev.d/apacer-1/mount

#!/bin/sh
if [ "$ACTION" == "add" ]
then
  USER=`ps -elf | grep x-session-manager | cut -d " " -f 3 | head -n 1`
  su -c "mount /media/palmint-1" $USER
fi

Create mountpoint:

mkdir /media/apacer-1

add following line in your /etc/fstab:

/dev/apacer-1   /media/apacer-1    auto    user,noauto,noatime,sync,defaults

Hal-volume-manager can show a lot informations about your hardware, but I couldn't find a package providing it.

2. DEVFS 

2.1. What it was? 

DEVFS is the old implementation of the dynamic device allocation. It has been replaced by UDEV.