1# This file contains the rules needed to create persistent device names. 2 3# we are only interested in add actions for block devices 4SUBSYSTEM!="block", GOTO="no_volume_id" 5ACTION!="add", GOTO="no_volume_id" 6 7# and we can safely ignore these kinds of devices 8KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="no_volume_id" 9 10# skip removable ide devices, because open(2) on them causes an events loop 11KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ 12 GOTO="no_volume_id" 13KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ 14 GOTO="no_volume_id" 15 16# skip xen virtual hard disks 17DRIVERS=="vbd", GOTO="no_hardware_id" 18 19# look for different kinds of unique identificators 20KERNEL=="hd*[!0-9]", \ 21 IMPORT{program}="ata_id --export $tempnode" 22 23KERNEL=="sd*[!0-9]|sr*|st*|nst*", ATTRS{ieee1394_id}=="?*", \ 24 ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" 25KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ 26 IMPORT{program}="usb_id -x" 27KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ 28 IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" 29KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ 30 IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" 31KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ 32 IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" 33KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ 34 IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" 35 36KERNEL=="dasd*[!0-9]", \ 37 IMPORT{program}="dasd_id --export $tempnode" 38 39KERNEL=="*[!0-9]", \ 40 IMPORT{program}="edd_id --export $tempnode" 41 42# find the physical path of the device 43KERNEL=="*[!0-9]|sr*|st*", IMPORT{program}="path_id $devpath" 44 45LABEL="no_hardware_id" 46 47# import the variables of partitions from the parent disks 48KERNEL=="*[0-9]", IMPORT{parent}="ID_*" 49 50KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ 51 SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" 52KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ 53 SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" 54KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL_SHORT}=="?*", \ 55 ENV{ID_VENDOR}=="ATA", \ 56 SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}" 57KERNEL=="sd*[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ 58 ENV{ID_VENDOR}=="ATA", \ 59 SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}-part%n" 60 61KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ 62 ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ 63 SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" 64KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ 65 ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ 66 SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" 67 68KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", \ 69 SYMLINK+="disk/by-id/edd-$env{ID_EDD}" 70KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ 71 SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" 72 73KERNEL=="sd*[!0-9]|dasd[!0-9]*|sr*", ENV{ID_SERIAL}=="?*", \ 74 SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" 75KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ 76 SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" 77KERNEL=="st*", ENV{ID_SERIAL}=="?*", \ 78 SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" 79KERNEL=="nst*", ENV{ID_SERIAL}=="?*", \ 80 SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" 81KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ 82 SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" 83 84KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ 85 SYMLINK+="disk/by-path/$env{ID_PATH}" 86KERNEL=="st*", ENV{ID_PATH}=="?*", \ 87 SYMLINK+="tape/by-path/$env{ID_PATH}" 88KERNEL=="sr*|st*", GOTO="no_volume_id" 89KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ 90 SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" 91 92# UUID and volume label 93KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="no_volume_id" 94IMPORT{program}="vol_id --export $tempnode" 95ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ 96 SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" 97ENV{ID_FS_LABEL_SAFE}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ 98 SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" 99 100# end of processing 101LABEL="no_volume_id" 102