linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* howto get serial number of a tape drive?
@ 2009-07-06 15:58 John Stoffel
  2009-07-06 16:09 ` Kay Sievers
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: John Stoffel @ 2009-07-06 15:58 UTC (permalink / raw)
  To: linux-hotplug


Hi,

I'm trying to make sure that my tape drives get named properly on
bootup in my tape library.  As far as I can determine, the
/lib/udev/scsi_id command requires that you use the SCSI Generic
device for the inquiry.  

How do I map from /dev/st0 to /dev/sg? within a udev rule so I can
pull out the proper serial number?

I've looked at the 60-persistent-storage-tape.rules file, but it
doesn't seem to help, or I'm just being dense somewhere?  

Here's my /etc/udev/rules.d/10-tape.rules file that I'm working with:

  # Sun SCSI DLT7k tape drive - make it /dev/tape by default
  BUS="scsi", SYSFS{model}="DLT7000",SYSFS{vendor}="SUN",SYMLINK="tape"

  # SCSI ATL P1000 Autoloader - make if /dev/changer 
  BUS="scsi", SYSFS{model}="P1000    6220051",SYSFS{vendor}="ATL",SYMLINK="changer"

  #-------------------------------------------------------------------------
  # SCSI ATL P1000 DLT 7000 tape drives
  # SCSI 2 is drive 0 in library, SerialNumber: 'CX752S1059' (left drive)
  # SCSI 3 is drive 1 in library, SerialNumber: 'PXB09S0552' (right drive)

  # ---------
  # Old tape_id script
  # ---------
  #BUS="scsi", KERNEL="nst[0-9]", PROGRAM="/lib/udev/tape_id %k", RESULT="CX752S1059", SYMLINK="dlt7k-left"
  #BUS="scsi", KERNEL="nst[0-9]", PROGRAM="/lib/udev/tape_id %k", RESULT="PXB09S0552", SYMLINK="dlt7k-right"

  # ---------
  # Try using /lib/udev/scsi_id --replace-whitespace --whitelisted
  # ---------

  # SQUANTUM_DLT7000_PXB09S0552

  #SUBSYSTEM="scsi_generic", PROGRAM="/lib/udev/scsi_id --replace-whitespace --whitelisted /dev/%k", RESULT="SQUANTUM_DLT7000_CX752S1059", SYMLINK="dlt7k-left"

  # Match scsi subsystem tape devices, stuff info into $BSG_DEV
  KERNEL="st*[0-9]|nst*[0-9]",           ENV{ID_SERIAL}!="?*", \
	  SUBSYSTEMS="scsi", KERNELS="[0-9]*:*[0-9]", \
	  ENV{BSG_DEV}="$root/bsg/$id"

  # Wait for the $BSG_DEV var to be defined, then run scsi_id on that value
  KERNEL="st*[0-9]|nst*[0-9]",           ENV{ID_SERIAL}!="?*", \
	  WAIT_FOR="$env{BSG_DEV}", \
	  ENV{ID_BUS}="scsi", \
	  IMPORT{program}="/lib/udev/scsi_id --replace-whitespace --whitelisted --export --device=$env{BSG_DEV}"

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

  KERNEL="st*[0-9]",ENV{ID_SERIAL}="SQUANTUM_DLT7000_PXB09S0552", \
	  SYMLINK+="dlt7k-right-st"
  KERNEL="nst*[0-9]",ENV{ID_SERIAL}="SQUANTUM_DLT7000_PXB09S0552", \
	  SYMLINK+="dlt7k-right-nst"

  KERNEL="st*[0-9]|nst*[0-9]", \
	  IMPORT{program}="/lib/udev/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"


Any hints on how I make this work better would be appreciated.

Thanks,
John

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-07 19:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-06 15:58 howto get serial number of a tape drive? John Stoffel
2009-07-06 16:09 ` Kay Sievers
2009-07-06 18:22 ` John Stoffel
2009-07-06 19:56 ` John Stoffel
2009-07-06 23:00 ` Kay Sievers
2009-07-06 23:02 ` Kay Sievers
2009-07-07  1:08 ` John Stoffel
2009-07-07  3:12 ` John Stoffel
2009-07-07  7:50 ` Kay Sievers
2009-07-07 19:34 ` John Stoffel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).