SUSE LINUX comes with scripts that allow you always to assign the same
designations to hard disks and other storage devices, no matter in
which order they are initialized.
/sbin/udev.get_persistent_device_name.sh is a wrapper
script. First it calls
/sbin/udev.get_unique_hardware_path.sh, which
finds the hardware path for a specified device.
/sbin/udev.get_unique_drive_id.sh retrieves the
serial number. Both outputs are then passed to udev,
which creates the symbolic link to the device node under
/dev. The wrapper can be used directly in the udev
rules. Here is an example for SCSI, which can also be generalized to USB or
IDE (write it as one line):
BUS="scsi",
PROGRAM="/sbin/udev.get_persistent_device_name.sh",
NAME="%k", SYMLINK="%c{1+}"As soon as a driver for a mass storage device has been loaded, it registers all the available hard disks with the kernel. Each of them triggers a hotplug block event that calls udev. Then udev reads the rules to determine whether a symlink needs to be created.
If the driver is loaded via initrd, the hotplug
events are lost. However, all the information is stored in
sysfs. The udevstart utility
finds all the device files under /sys/block and
/sys/class and starts udev.
There is also a start script boot.udev, which recreates
all the device nodes during the boot process. However, the start script
must be activated through the YaST runlevel editor or with the command
insserv boot.udev.