1 | ########################################################################
|
---|
2 | #
|
---|
3 | # Description : Persistent Rules
|
---|
4 | #
|
---|
5 | # Authors : Based on Open Suse Udev Rules
|
---|
6 | # kay.sievers@suse.de and hare@suse.de
|
---|
7 | #
|
---|
8 | # Adapted to : Jim Gifford
|
---|
9 | # LFS
|
---|
10 | #
|
---|
11 | # Version : 00.01
|
---|
12 | #
|
---|
13 | # Notes :
|
---|
14 | #
|
---|
15 | ########################################################################
|
---|
16 |
|
---|
17 | # persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path}
|
---|
18 | # scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
|
---|
19 |
|
---|
20 | ACTION!="add", GOTO="persistent_end"
|
---|
21 | SUBSYSTEM!="block", GOTO="persistent_end"
|
---|
22 |
|
---|
23 | # skip rules for inappropriate block devices
|
---|
24 | KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end"
|
---|
25 |
|
---|
26 | # never access removable ide devices, the drivers are causing event loops on open()
|
---|
27 | BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end"
|
---|
28 |
|
---|
29 | # by-id (hardware serial number)
|
---|
30 | KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode"
|
---|
31 | KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
|
---|
32 | KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
|
---|
33 |
|
---|
34 | KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394"
|
---|
35 | KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x"
|
---|
36 | KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode"
|
---|
37 | KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode"
|
---|
38 | KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode"
|
---|
39 | KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
|
---|
40 |
|
---|
41 | # for partitions import parent information
|
---|
42 | KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*"
|
---|
43 | KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
|
---|
44 |
|
---|
45 | # by-path (shortest physical path)
|
---|
46 | KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
|
---|
47 | KERNEL=="sr*", GOTO="persistent_end"
|
---|
48 | KERNEL=="*[0-9]", IMPORT{parent}=="ID_*"
|
---|
49 | KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
|
---|
50 |
|
---|
51 | # by-label/by-uuid (filesystem properties)
|
---|
52 | KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end"
|
---|
53 | IMPORT{program}="/sbin/vol_id --export $tempnode"
|
---|
54 | ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
|
---|
55 | ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
|
---|
56 |
|
---|
57 | # BIOS Enhanced Disk Device
|
---|
58 | KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode"
|
---|
59 | KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
|
---|
60 | KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
|
---|
61 |
|
---|
62 | KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c"
|
---|
63 |
|
---|
64 | LABEL="persistent_end"
|
---|