[CentOS] udev on CEntOS7 - can't get a match, looking for tips...

John H Nyhuis

jnyhuis at uw.edu
Mon Oct 28 17:14:09 UTC 2019


The mtx binary requires my tape library to be assigned a sg# driver, but 
the kernel periodically renumbers the sg devices.  Normally, we would 
write a udev rule to manually assign a persistent name, but it looks 
like things have changed as I can't seem to get a match on CEntOS7.  I'd 
appreciate any feedback or pointers to help me get my rule working.  My 
two attempts are below.

cat /etc/udev/rules.d/90-local.rules

KERNEL=="sg[0-9]*", SUBSYSTEM=="scsi_generic", \
ENV{ID_SERIAL}=="1QUANTUM_D0H0112430_LLA", SYMLINK+="sg8"

SUBSYSTEM=="scsi", SUBSYSTEMS=="scsi_genric", \
ATTRS{model}=="Scalar i40-i80  ", SYMLINK:="sg8"

Neither rule above generates a match with udev, so I still have 
something wrong.  Right now the assignment is sg7 (but it's had other 
names in the past.

udevadm info --query=all --name=/dev/sg7
P: 
/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1/scsi_generic/sg7
N: sg7
S: tape/by-id/scsi-1QUANTUM_D0H0112430_LLA
E: DEVLINKS=/dev/tape/by-id/scsi-1QUANTUM_D0H0112430_LLA
E: DEVNAME=/dev/sg7
E: 
DEVPATH=/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1/scsi_generic/sg7
E: ID_MODEL=Scalar_i40-i80
E: ID_MODEL_ENC=Scalar\x20i40-i80\x20\x20
E: ID_REVISION=190G
E: ID_SCSI=1
E: ID_SCSI_SERIAL=QUANTUMD0H0112430_LLA
E: ID_SERIAL=1QUANTUM_D0H0112430_LLA
E: ID_SERIAL_SHORT=QUANTUM_D0H0112430_LLA
E: ID_TYPE=generic
E: ID_VENDOR=QUANTUM
E: ID_VENDOR_ENC=QUANTUM\x20
E: MAJOR=21
E: MINOR=7
E: SUBSYSTEM=scsi_generic
E: USEC_INITIALIZED=28815292891


Assigned and parent device listed below:
udevadm info -a -p `udevadm info -q path -n /dev/sg7`

   looking at device 
'/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1/scsi_generic/sg7':
     KERNEL=="sg7"
     SUBSYSTEM=="scsi_generic"
     DRIVER==""

   looking at parent device 
'/devices/pci0000:00/0000:00:07.0/0000:04:00.0/0000:05:00.0/0000:06:00.1/host8/rport-8:0-0/target8:0:0/8:0:0:1':
     KERNELS=="8:0:0:1"
     SUBSYSTEMS=="scsi"
     DRIVERS=="ch"
     ATTRS{rev}=="190G"
     ATTRS{type}=="8"
     ATTRS{scsi_level}=="4"
     ATTRS{model}=="Scalar i40-i80  "
     ATTRS{state}=="running"
     ATTRS{unpriv_sgio}=="0"
     ATTRS{queue_type}=="none"
     ATTRS{iodone_cnt}=="0xe2"
     ATTRS{iorequest_cnt}=="0xe2"
     ATTRS{queue_ramp_up_period}=="120000"
     ATTRS{device_busy}=="0"
     ATTRS{evt_capacity_change_reported}=="0"
     ATTRS{timeout}=="0"
     ATTRS{evt_media_change}=="0"
     ATTRS{ioerr_cnt}=="0x7"
     ATTRS{queue_depth}=="30"
     ATTRS{vendor}=="QUANTUM "
     ATTRS{evt_soft_threshold_reached}=="0"
     ATTRS{device_blocked}=="0"
     ATTRS{evt_mode_parameter_change_reported}=="0"
     ATTRS{evt_lun_change_reported}=="0"
     ATTRS{evt_inquiry_change_reported}=="0"
     ATTRS{dh_state}=="detached"
     ATTRS{iocounterbits}=="32"
     ATTRS{eh_timeout}=="10"


Would anyone mind pointing out the error in my udev rule or proposing a 
better way of getting a persistent sg device name?

-- 
Thanks in advance,

John H. Nyhuis
Desk: (206)-685-8334
jnyhuis at uw.edu
Box 359461, 15th floor, 106


More information about the CentOS mailing list