[7e161ea] | 1 | ########################################################################
|
---|
| 2 | #
|
---|
[26b1cc1] | 3 | # Description : 60-persistent-disk.rules
|
---|
[7e161ea] | 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 |
|
---|
[95756c0] | 17 | # persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name}
|
---|
[7e161ea] | 18 | # scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
|
---|
| 19 |
|
---|
[95756c0] | 20 | ACTION!="add", GOTO="persistent_storage_end"
|
---|
[5b4b253] | 21 |
|
---|
| 22 | KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode"
|
---|
| 23 | KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode"
|
---|
| 24 | KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst"
|
---|
| 25 |
|
---|
| 26 | # type 8 devices are "Medium Changers"
|
---|
| 27 | KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode"
|
---|
| 28 | KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode"
|
---|
| 29 | KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
|
---|
| 30 |
|
---|
[95756c0] | 31 | SUBSYSTEM!="block", GOTO="persistent_storage_end"
|
---|
[7e161ea] | 32 |
|
---|
| 33 | # skip rules for inappropriate block devices
|
---|
[90d6419] | 34 | KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end"
|
---|
[bda8cfb] | 35 |
|
---|
[95756c0] | 36 | # never access non-cdrom removable ide devices, the drivers are causing event loops on open()
|
---|
| 37 | KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
|
---|
| 38 | KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
|
---|
[7e161ea] | 39 |
|
---|
[95756c0] | 40 | # ignore partitions that span the entire disk
|
---|
| 41 | ATTR{whole_disk}=="", GOTO="persistent_storage_end"
|
---|
[1400499] | 42 |
|
---|
| 43 | # for partitions import parent information
|
---|
[95756c0] | 44 | KERNEL=="*[0-9]", IMPORT{parent}="ID_*"
|
---|
[7e161ea] | 45 |
|
---|
| 46 | # by-id (hardware serial number)
|
---|
[95756c0] | 47 | KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
|
---|
| 48 | KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
|
---|
| 49 | KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
|
---|
[5b4b253] | 50 |
|
---|
| 51 | KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
|
---|
| 52 | KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x"
|
---|
| 53 | KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode"
|
---|
[95756c0] | 54 | KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode"
|
---|
[5b4b253] | 55 | KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
|
---|
[95756c0] | 56 | KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
|
---|
[2b92d03] | 57 |
|
---|
| 58 | # libata compat (links like hd*)
|
---|
[95756c0] | 59 | KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result"
|
---|
| 60 | KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}"
|
---|
| 61 | KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n"
|
---|
[5b4b253] | 62 |
|
---|
[95756c0] | 63 | KERNEL=="mmcblk[0-9]", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"
|
---|
| 64 | KERNEL=="mmcblk[0-9]p[0-9]", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n"
|
---|
[7e161ea] | 65 |
|
---|
| 66 | # by-path (shortest physical path)
|
---|
[1400499] | 67 | KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
|
---|
| 68 | KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}"
|
---|
| 69 | KERNEL=="sr*|st*", GOTO="persistent_storage_end"
|
---|
| 70 | KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
|
---|
[7e161ea] | 71 |
|
---|
| 72 | # by-label/by-uuid (filesystem properties)
|
---|
[95756c0] | 73 | KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
|
---|
[dfdebf6] | 74 | IMPORT{program}="vol_id --export $tempnode"
|
---|
[95756c0] | 75 | ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
---|
| 76 | ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
|
---|
[7e161ea] | 77 |
|
---|
| 78 | # BIOS Enhanced Disk Device
|
---|
[95756c0] | 79 | KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode"
|
---|
| 80 | KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
|
---|
| 81 | KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
|
---|
[7e161ea] | 82 |
|
---|
[bda8cfb] | 83 | LABEL="persistent_storage_end"
|
---|