chiark / gitweb /
4b591b02fa591bcf7ae91fbc9173f37cbd7b54a7
[elogind.git] / etc / udev / debian / persistent.rules
1 # This file contains the rules needed to create persistent device names.
2
3 # we are only interested in add actions for block devices
4 SUBSYSTEM!="block",                     GOTO="no_volume_id"
5 ACTION!="add",                          GOTO="no_volume_id"
6
7 # and we can safely ignore these kinds of devices
8 KERNEL=="ram*|loop*|fd*|nbd*",          GOTO="no_volume_id"
9
10 # skip removable ide devices, because open(2) on them causes an events loop
11 BUS=="ide", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="no_volume_id"
12
13 # look for different kinds of unique identificators
14 KERNEL=="hd*[!0-9]", \
15         IMPORT{program}="/sbin/ata_id --export $tempnode"
16
17 KERNEL=="sd*[!0-9]|sr*",                SYSFS{ieee1394_id}=="?*", \
18         ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$sysfs{ieee1394_id}"
19 KERNEL=="sd*[!0-9]|sr*",                ENV{ID_SERIAL}=="", \
20         IMPORT{program}="/sbin/usb_id -x"
21 KERNEL=="sd*[!0-9]|sr*",                ENV{ID_SERIAL}=="", \
22         IMPORT{program}="/sbin/scsi_id -g -x -s $devpath -d $tempnode"
23 KERNEL=="sd*[!0-9]|sr*",                ENV{ID_SERIAL}=="", \
24         IMPORT{program}="/sbin/scsi_id -g -x -a -s $devpath -d $tempnode"
25
26 KERNEL=="dasd*[!0-9]", \
27         IMPORT{program}="/sbin/dasd_id --export $tempnode"
28
29 KERNEL=="*[!0-9]", SYSFS{removable}!="1", \
30         IMPORT{program}="/sbin/edd_id --export $tempnode"
31
32 # find the physical path of the device
33 KERNEL=="*[!0-9]|sr*",                  ENV{ID_TYPE}=="?*", \
34         IMPORT{program}="/sbin/path_id $devpath"
35
36 # import the variables of partitions from the parent disks
37 KERNEL=="*[0-9]",                       IMPORT{parent}="ID_*"
38
39 KERNEL=="hd*[!0-9]",                    ENV{ID_SERIAL}=="?*", \
40         SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
41 KERNEL=="hd*[0-9]",                     ENV{ID_SERIAL}=="?*", \
42         SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
43 KERNEL=="sd*[!0-9]|dasd[!0-9]*|sr*",    ENV{ID_SERIAL}=="?*", \
44         SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
45 KERNEL=="sd*[0-9]|dasd*[0-9]",          ENV{ID_SERIAL}=="?*", \
46         SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
47 KERNEL=="*[!0-9]",                      ENV{ID_EDD}=="?*", \
48         SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
49 KERNEL=="*[0-9]",                       ENV{ID_EDD}=="?*", \
50         SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
51
52 KERNEL=="*[!0-9]|sr*",                  ENV{ID_PATH}=="?*", \
53         SYMLINK+="disk/by-path/$env{ID_PATH}"
54 KERNEL=="sr*",                          GOTO="no_volume_id"
55 KERNEL=="*[0-9]",                       ENV{ID_PATH}=="?*", \
56         SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
57
58 # UUID and volume label
59 KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id"
60 IMPORT{program}="/sbin/vol_id --export $tempnode"
61 ENV{ID_FS_UUID}=="?*",          SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
62 ENV{ID_FS_LABEL_SAFE}=="?*",    SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
63
64 # end of processing
65 LABEL="no_volume_id"
66