udev naming of st devices [was Re: iSCSI device naming issues]

Patrick Mansfield
2004-07-01T17:29:58Z

[adding linux-hotplug-devel]

On Thu, Jul 01, 2004 at 08:57:14AM -0700, Mike Anderson wrote:
> Surekha.PC [surekhap@cisco.com] wrote:
> > 3) Make use of scsi_id.
> > scsi_id can be used to get unique name instead of parsing sysfs
> > path for device name creation. However scsi_id is helpful only
> > for block devices, and there is no way to handle unique naming
> > for tape devices. So this will not make a complete solution.
>
> Well you can still setup a udev rule to use scsi_id for you block
> devices and then use location naming for the tapes ( some newer
> generation tape drives also support serial numbers).

Yes, I had no problems running scsi_id on some older DLT drives (DLT
4000?).

There is a naming issue with st, in that unique tape names need to put an
identifier in the middle of the different names, or at least parse out a
middle portion of the kernel name.

That is, tape names are of the form:

st13
st13a
st13l
st13m
nst13
nst13a
nst13l
nst13m

So if you want a unique name in the above, you would generally want to
substitute the 13 with a value.

You can't do this with a one line udev rule, using scsi_id with an eight
line rule (each one containing the same scsi_id value to match) is ugly,
and I'm not sure if it would work (udev wildcard pattern matching for
things like st[0-9]*l).

A script could be written to handle this, it would be passed a kernel
name, a scsi_id value to match and a name string. It would call scsi_id,
and if it matches the passed in value, return the name string for the
device wrapped with pre and post fixes.

Or maybe udev can be changed to better handle this, but I don't have
suggestions or patches.

Changing st default kernel names would simplify the problem, but is not
allowed.

-- Patrick Mansfield