[NTLUG:Discuss] udev - how do get it to create a tape /dev?
Richard Geoffrion
ntlug at rain4us.net
Fri Jan 20 13:38:02 CST 2006
The SCSI Generic driver is loaded, the system sees the tape drive AND
the robotic arm (lun 1), and the tape drive is right there under
/dev/sg10 with the changer being /dev/sg11. The problem is that those
device numbers won't always be the same depending on how many of the hot
pull SCSI drives are in the bays when the system powers up. With UDEV
creating these devices on the fly, I need a way to have a stable
/dev/$name created so that I don't have to hit a moving target.
I've searched in vain for examples and I'm coming up empty trying to
find the documentation on how to make udev auto create a stable
/dev/$name.
While putting together documentation and proof of how all of my searches
for help failed, I found
http://www.reactivated.net/writing_udev_rules.html . I can't say
enough good things about this documentation! The guy uses EXAMPLES!!! I
am ALMOST in heaven --- almost because I still seem to be stuck.
To identify my devices, I started in /var/log/messages with this...
---
Jan 19 12:27:36 gwibkp kernel: [ 330.856476] scsi4 : Adaptec AIC7XXX
EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0
Jan 19 12:27:51 gwibkp udev[4135]: removing device node '/dev/target4:0:0'
Jan 19 12:27:52 gwibkp kernel: [ 347.526389] Vendor: ARCHIVE Model:
Python 06241-XXX Rev: 9100
Jan 19 12:27:52 gwibkp kernel: [ 347.526401] Type:
Sequential-Access ANSI SCSI revision:
03
Jan 19 12:27:52 gwibkp kernel: [ 347.526427] target4:0:6: Beginning
Domain Validation
Jan 19 12:27:52 gwibkp kernel: [ 347.532654] target4:0:6: wide
asynchronous.
Jan 19 12:27:52 gwibkp kernel: [ 347.554691] target4:0:6: Domain
Validation skipping write tests
Jan 19 12:27:52 gwibkp kernel: [ 347.555884] target4:0:6: FAST-20 WIDE
SCSI 40.0 MB/s ST (50 ns, offset 32)
Jan 19 12:27:52 gwibkp scsi.agent[4220]: how to add device type= at
/devices/pci0000:00/0000:00:0e.0/host4/tar
get4:0:6/4:0:6:0 ??
Jan 19 12:27:52 gwibkp kernel: [ 347.560632] target4:0:6: Ending
Domain Validation
Jan 19 12:27:52 gwibkp kernel: [ 347.595306] Attached scsi generic sg10
at scsi4, channel 0, id 6, lun 0, ty
pe 1
Jan 19 12:27:52 gwibkp udev[4240]: creating device node '/dev/sg10'
Jan 19 12:27:52 gwibkp scsi.agent[4250]: how to add device type= at
/devices/pci0000:00/0000:00:0e.0/host4/tar
get4:0:6/4:0:6:1 ??
Jan 19 12:27:52 gwibkp kernel: [ 347.614455] Vendor: ARCHIVE Model:
Python 06241-XXX Rev: 9100
Jan 19 12:27:52 gwibkp kernel: [ 347.614466] Type: Medium
Changer ANSI SCSI revision:
03
Jan 19 12:27:52 gwibkp kernel: [ 347.614479] target4:0:6: FAST-20 WIDE
SCSI 40.0 MB/s ST (50 ns, offset 32)
Jan 19 12:27:52 gwibkp kernel: [ 347.649329] Attached scsi generic sg11
at scsi4, channel 0, id 6, lun 1, ty
pe 8
Jan 19 12:27:53 gwibkp udev[4270]: creating device node '/dev/sg11'
----
using devices/pci0000:00/0000:00:0e.0/host4/target4:0:6/4:0:6:0 and
devices/pci0000:00/0000:00:0e.0/host4/target4:0:6/4:0:6:1 as a starting
point, I run udevinfo and get...
[udevinfo results]
# udevinfo -a -p
/sys/devices/pci0000:00/0000:00:0e.0/host4/target4:0:6/4:0:6:0
looking at class device
'/sys/devices/pci0000:00/0000:00:0e.0/host4/target4:0:6/4:0:6:0':
SUBSYSTEM=="unknown"
SYSFS{device_blocked}=="0"
SYSFS{iocounterbits}=="32"
SYSFS{iodone_cnt}=="0x11"
SYSFS{ioerr_cnt}=="0x5"
SYSFS{iorequest_cnt}=="0x11"
SYSFS{model}=="Python 06241-XXX"
SYSFS{queue_depth}=="2"
SYSFS{queue_type}=="none"
SYSFS{rev}=="9100"
SYSFS{scsi_level}=="4"
SYSFS{state}=="running"
SYSFS{timeout}=="0"
SYSFS{type}=="1"
SYSFS{vendor}=="ARCHIVE "
[/ results]
I think I was able toproperly identify both devices this way and I wound
up creating two rules to handle the drive. I changed the "type" where
appropriate. They didn't seem to work though.
[udev.rules insert]
BUS="scsi", KERNEL="sg[0-9]*",SYSFS{model}="Python 06241-XXX",
SYSFS{type}="1", NAME="%k", SYMLINK="tapedrive"
BUS="scsi", KERNEL="sg[0-9]*",SYSFS{model}="Python 06241-XXX",
SYSFS{type}="8", NAME="%k", SYMLINK="tapearm"
[/insert]
When I try to diagnose my udev rule, I try to query the device by the
name assigned to it, /dev/sg10 but I get....
[query device]
# udevinfo -q all -n /dev/sg10
device not found in database
#
[/query]
So..now I don't know where I need to go next. I've hit the perverbial
brick wall due to my inability to interpret/understand what udev is
doing and why it's missing my scsi device. Any insights??
--
Richard (the noobie)
More information about the Discuss
mailing list