1

I have a problem, whenever the library is rebooted, a cartdrige is mounted, or any operation, Linux is changing path for library, making it unavailable to automate backup procesing, it is even worst when I have two drives on a library because system changes xxx0 to xxx1 and reverse, when fc is unplugged, system reboot or w/e

I would like to know how to make a persistent configuration on udev to assign everytime the same path to the same tape-device-w/e based on it's serial number, for example, because it never changes, so it will be xxx0 for SN 1234 everytime, xxx1 for 5678, etc. Even if system is rebooted...

I am used a custom linux based on Debian distro's so everything that works on Debian works on mine...

I hope you can help me, thank you.

This is my info...

root@wbsairback:~# cat /proc/scsi/scsi
Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: IBM      Model: ULT3580-HH5      Rev: D2AD
  Type:   Sequential-Access                ANSI  SCSI revision: 06
Host: scsi1 Channel: 00 Id: 00 Lun: 01
  Vendor: IBM      Model: 3573-TL          Rev: C.00
  Type:   Medium Changer                   ANSI  SCSI revision: 05

It is mounted under

root@wbsairback:/etc/udev/rules.d#  ls -l /dev/tape/by-id
total 0
lrwxrwxrwx 1 root root  9 ago 26 08:25 sch-IBM-3573-TL-00X2U78Z7696_LL0 -> ../../sg4
lrwxrwxrwx 1 root root 11 ago 26 08:25 st--- -> ../../nst0m
lrwxrwxrwx 1 root root 10 ago 26 08:25 st-IBM-ULT3580-HH5-5000e11159a60001 -> ../../nst0

And this is my udev config

ACTION!="add|change",                   GOTO="persistent_storage_tape_end"

# "Medium Changers"
KERNEL=="sg[0-9]*", \
        SUBSYSTEMS=="scsi", ATTRS{type}=="8", \
        IMPORT{program}="/lib/udev/scsi_id --export --sg-version=3 --whitelisted --device=$tempnode"

KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --page=0x80 --export --whitelisted --device=$tempnode", SYMLINK+="tape/by-id/sch-$env{ID_VENDOR}-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}"

SUBSYSTEM!="scsi_tape",                 GOTO="persistent_storage_tape_end"

KERNEL=="st*[0-9]|nst*[0-9]",           ATTRS{ieee1394_id}=="?*", \
        ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}"
KERNEL=="st*[0-9]|nst*[0-9]",           ENV{ID_SERIAL}!="?*", \
        SUBSYSTEMS=="usb", \
        IMPORT{program}="usb_id --export $devpath"

KERNEL=="st*[0-9]|nst*[0-9]",           ENV{ID_SERIAL}!="?*", \
        SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \
        ENV{BSG_DEV}="$root/bsg/$id"
KERNEL=="st*[0-9]|nst*[0-9]",           ENV{ID_SERIAL}!="?*", \
        WAIT_FOR="$env{BSG_DEV}", \
        ENV{ID_BUS}="scsi", \
        IMPORT{program}="scsi_id --export --device=$env{BSG_DEV}"

KERNEL=="st*[0-9]",                     ENV{ID_SERIAL}=="?*", \
        SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
KERNEL=="nst*[0-9]",                    ENV{ID_SERIAL}=="?*", \
        SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst"

KERNEL=="nst[0-9]*", SUBSYSTEM=="scsi_tape", IMPORT{program}="scsi_id -u -g -x -d $tempnode", SYMLINK+="tape/by-id/st-$env{ID_VENDOR}-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}"

KERNEL=="st*[0-9]|nst*[0-9]", \
        IMPORT{program}="path_id $devpath"
KERNEL=="st*[0-9]",                     ENV{ID_PATH}=="?*", \
        SYMLINK+="tape/by-path/$env{ID_PATH}"
KERNEL=="nst*[0-9]",                    ENV{ID_PATH}=="?*", \
        SYMLINK+="tape/by-path/$env{ID_PATH}-nst"

# end of processing
LABEL="persistent_storage_tape_end"
  • `/dev/tape/by-id/sch-IBM-3573-TL-00X2U78Z7696_LL0` never changes. – Michael Hampton Aug 26 '13 at 15:07
  • But if I reboot the library, move cartdriges or whatever, my application is running in background, so for example if I reboot the library I need to make a rescan for scsi devices, even if I'm inside `/dev/tape/by-id/` I do `ls` and it's OK, reboot library, when it says 'ready' on lcd, I do `ls` but is **empty** I need to go back with `cd ..` then `cd by-id/` and now `ls` shows my stuff.. So I think that is the problem, my application needs to rescan everytime but I don't want to, there isn't a way to do it automatically? – Robert W. Hunter Aug 26 '13 at 15:43

0 Answers0