• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# do not edit this file, it will be overwritten on update
2
3# persistent storage links: /dev/disk/{by-id,by-path}
4# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
5
6# This file contains rules for setting udev environment variables based on
7# hardware properties (serial numbers etc), which can be obtained without
8# actually reading from the device.
9#
10# Hopefully this will be integrated into systemd/udev soon (as 54-storage-hardware.rules).
11# Until then, we ship it here in sg3-utils.
12# It's important that rules dealing with low-level hardware attributes run
13# before the generic SCSI rules in 55-scsi-sg3_utils.rules.
14
15ACTION=="remove", GOTO="storage_hardware_end"
16SUBSYSTEM!="block", GOTO="block_storage_end"
17KERNEL!="sd*|sr*|cciss*", GOTO="block_storage_end"
18
19# ignore partitions that span the entire disk
20TEST=="whole_disk", GOTO="block_storage_end"
21
22# for partitions import parent information
23ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}!="?*", IMPORT{parent}="ID_*"
24
25# ATA
26KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"
27
28# ATAPI devices (SPC-3 or later)
29KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode"
30
31# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures)
32KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode"
33
34# Fall back usb_id for USB devices
35KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id"
36
37# FireWire
38ENV{ID_IEEE1394}!="?*", KERNEL=="sd*|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_IEEE1394}="$attr{ieee1394_id}"
39
40# by-path
41ENV{ID_PATH}!="?*", ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
42
43LABEL="block_storage_end"
44
45# SCSI tape devices
46SUBSYSTEM!="scsi_tape", GOTO="storage_hardware_end"
47KERNEL!="st*[0-9]|nst*[0-9]", GOTO="storage_hardware_end"
48
49ENV{ID_SERIAL}!="?*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
50ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", ATTRS{serial}=="?*", IMPORT{builtin}="usb_id"
51
52# by-path
53ENV{ID_PATH}!="?*", IMPORT{builtin}="path_id"
54
55LABEL="storage_hardware_end"
56