Re: SCSI device numbering (was: Re: Ideas for v2.1

David Hinds (
Wed, 3 Jul 1996 11:53:15 -0700

Linus Torvalds ( wrote:

: Or think of a portable: that's where you'd be a lot mroe likely to have
: the SCSI controller move around. Maybe somebody some day makes a PCMCIA
: SCSI card (or maybe they already exist?). Are you _really_ arguing for a
: setup where the disk numbers change depending on which PCMCIA slot the
: user has happened to use (or whether it's docked, perhaps).

PCMCIA SCSI adapters already exist :)

I'm not sure if it yields any useful ideas for dealing with
permanently attached devices, but here is the solution I came up with
for handling devices attached to removable adapters...

When a new adapter is inserted at run time, a daemon invokes a SCSI
startup script, which generates an "address" for each probed SCSI
device, which is a string of the form:


("scheme" isn't relevant, it is a way the PCMCIA drivers keep track of
separate sets of configuration information for, say, home and work, or
on-line and off-line). The addresses are used to look up "what to do"
in another script. That script doesn't need to know that the address
"home,sd,0,0,1,0" corresponds to /dev/sda. It may ignore some parts
of an address when deciding what to do. For example, the default
option script is this:

case "$ADDRESS" in
DO_FSTAB="y" ; DO_FSCK="n" ; DO_MOUNT="y"

which says that for any CD-ROM device, create an appropriate entry in
/etc/fstab, and try to mount the device on /cdrom.

Other fields could be added to the ADDRESS: for instance, serial
numbers, or vendor/model information. For multi-partition devices, an
extra partition field is tacked onto the ADDRESS, so that options can
be specified for each partition separately. The idea is that the
option script contains all the information needed for updating system
files that depend on actual device names.

With this arrangement, I can mix and match whatever SCSI devices I
want on my adapter, and since their ADDRESS strings don't change, they
will all be configured the same way every time. With no kernel
support. I do have a little utility that translates SCSI device names
(like /dev/sda) to channel,id,lun numbers, but it just uses the

For non-PCMCIA adapters, I suppose something similar could be done at
boot time, or perhaps whenever a change in SCSI device configuration
is detected (somehow). This would seem to handle most of the things
that people have said they would like to do, no?

-- Dave Hinds