diff options
Diffstat (limited to 'scripts/54-before-scsi-sg3_id.rules')
-rw-r--r-- | scripts/54-before-scsi-sg3_id.rules | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/54-before-scsi-sg3_id.rules b/scripts/54-before-scsi-sg3_id.rules new file mode 100644 index 00000000..bb36650a --- /dev/null +++ b/scripts/54-before-scsi-sg3_id.rules @@ -0,0 +1,55 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/disk/{by-id,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de> + +# This file contains rules for setting udev environment variables based on +# hardware properties (serial numbers etc), which can be obtained without +# actually reading from the device. +# +# Hopefully this will be integrated into systemd/udev soon (as 54-storage-hardware.rules). +# Until then, we ship it here in sg3-utils. +# It's important that rules dealing with low-level hardware attributes run +# before the generic SCSI rules in 55-scsi-sg3_utils.rules. + +ACTION=="remove", GOTO="storage_hardware_end" +SUBSYSTEM!="block", GOTO="block_storage_end" +KERNEL!="sd*|sr*|cciss*", GOTO="block_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="block_storage_end" + +# for partitions import parent information +ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}!="?*", IMPORT{parent}="ID_*" + +# ATA +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode" + +# ATAPI devices (SPC-3 or later) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode" + +# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode" + +# Fall back usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" + +# FireWire +ENV{ID_IEEE1394}!="?*", KERNEL=="sd*|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_IEEE1394}="$attr{ieee1394_id}" + +# by-path +ENV{ID_PATH}!="?*", ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" + +LABEL="block_storage_end" + +# SCSI tape devices +SUBSYSTEM!="scsi_tape", GOTO="storage_hardware_end" +KERNEL!="st*[0-9]|nst*[0-9]", GOTO="storage_hardware_end" + +ENV{ID_SERIAL}!="?*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", ATTRS{serial}=="?*", IMPORT{builtin}="usb_id" + +# by-path +ENV{ID_PATH}!="?*", IMPORT{builtin}="path_id" + +LABEL="storage_hardware_end" |