From: "John Stoffel" Date: Mon, 06 Jul 2009 18:22:00 +0000 Subject: Re: howto get serial number of a tape drive? Message-Id: <19026.16584.136177.940234@stoffel.org> List-Id: References: <19026.7962.882759.229031@stoffel.org> In-Reply-To: <19026.7962.882759.229031@stoffel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org >>>>> "Kay" =3D Kay Sievers writes: Kay> On Mon, Jul 6, 2009 at 17:58, John Stoffel wrote: >> I'm trying to make sure that my tape drives get named properly on >> bootup in my tape library. =A0As far as I can determine, the >> /lib/udev/scsi_id command requires that you use the SCSI Generic >> device for the inquiry. Kay> Some tape nodes don't like to be opened, they rewind the tape, Kay> that's why they are not used. That's fine, since I can poke at the SG device for the tape drive and get it's serial number. And I think I can write a UDEV rule to do so, if I can figure out how to map a SCSI_TAPE device to it's SCSI_GENERIC device.=20 >> How do I map from /dev/st0 to /dev/sg? within a udev rule so I can >> pull out the proper serial number? Kay> The old sg stuff willnot work, bsg has the same name as the SCSI Kay> LUN and is guaranteed to be there. So I should be running /lib/udev/scsi_id at the bsg device? Is that device kept in an environment variable? =20 >> 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? Kay> Which udev version? What's missing in /dev/tape/? I'm using a Debian testing system running udev 141 right now. Right now in /dev/tape I have: > find /dev/tape /dev/tape /dev/tape/by-path /dev/tape/by-path/pci-0000:00:0d.1-scsi-0:0:2:0-st /dev/tape/by-path/pci-0000:00:0d.1-scsi-0:0:2:0-nst-nst /dev/tape/by-path/pci-0000:00:0d.0-scsi-0:0:3:0-st /dev/tape/by-path/pci-0000:00:0d.0-scsi-0:0:3:0-nst-nst Do I need to pull out the various #:#:#:# part of the by-path stuff to figure out which device ID I need to query against to get my low level SCSI ID? =20 Sorry to be asking so many questions, but udev isn't the easiest thing to wrap my brain around for some reason. Please let me know if I need to provide more details or information. Thanks, John