Linux Step By Steps

SCSI DRIVERS

From mikea@norfolk.nf

SEE ALSO CD BURNERS -> SCSI

THE FOLLOWING TWO StepBySteps give practical examples on installing two distinctly different devices

SCSI PCI HARD DISK

SCSI ISAPNP CDROM

The emphasis here is not so much on the hard disk, or cd, but the differences between the two SCSI card types.

The examples apply to AHA151x / 152x ISAPNP controller and

NCR 53C810 PCI Controller

Your mileage is going to vary with the card of your system, but the principles involved will help you greatly in installing it. A couple of important Steps apply to both and are written here to avoid repetition later.


Step First: Making space.

Both types of devices (cd or hd) need to be incorporated into the Linux file system. The way this is acheived is by making  space available in that file system as follows.

mkdir /anywhere/anyplace
chmod 777 /anywhere/anyplace

What you are doing here is creating a hole for the device to fill. The permissions at first glance are not what they appear to be. Rather than supplying read write permissions, when it applies to a directory, they mean, allow anyone to enter that directory.

Step Last: Mounting

This step cannot be achieved until the steps for scsi cd, or for scsi hd are achieved. However, it is important for you to follow the principles of what's happening, and to make it easy on yourself forever more.

Fact one: Logical device numbering

Irrespective of the unit number of a scsi device (0 to 6), the first one detected is the first logical device. Hence for hard disks it is /dev/sdaX  and, for cdroms it is /dev/scd0. This is contrary to your experience on IDE interfaces.

Fact two: A rose by any other name....

You will discover confusing documentation throughout linux referring to device names other than above (such as sr0 for cd's). This is because linux is evolving and, basically, the names change to a more enhanced generic driver leaving the older 'interface' to support programs that require it. The devices you are interested in are /dev/sdaX and /dev/scd0.

Fact three: Partitioning.

A Hard disk is partitioned, whether you like it or not. Therefore, while the device is /dev/sda,  the partition that probably interests you most is /dev/sda1.

A CD rom is not partitioned, whether you like it or not. Therefore the device you are interested in is and can only ever be /dev/scd0. (scd1 would refer to a second cd rom).

The most expedient method of testing your installation is

"mount -t iso9660 /dev/scd0    /myscsi"    # for cd, and
"mount -t ext2       /dev/sda1    /myscsi"   # for hard disk.

The reference to "myscsi" corresponds to the /anywhere/anyplace" directory you made in step first.

This typing of course is tedious.

To allow permanent shorthand you can put these entries into /etc/fstab

/dev/scd0    ext2  /myscsi     defaults,noauto, user  0 0

what this line does is allow anyone ('user') to access the drive, and 'noauto' to prevent it being mounted at boot time. Both options are more important than their due. The lack of them are the cause of much frustration to the newbie. It is embarrasing to automount a cd at boot time when it isn't there! Some caution if you choose to automount any device please. The locate database will include all mounted devices in it's search. This means typing "locate fred" can come up with files on unwanted devices. Use automount with wisdom.

Once an entry is placed in /etc/fstab you can use shorthand

mount  /myscsi

is all that is required.


Further info to get you thinking..... The all encompassing kernel modules...

This information won't help you one jot, getting your cd scsi to fly. You can safely skip this blurb. However, if you follow along, you will have a very strong understanding of where all the pieces fit together.

When you make a reference to /dev/anything, the kernel translates this to a MAJOR device number. Every major device in a linux OS has a corresponding, unique,  'driver'.  Serial drivers, console drivers, ide drivers, scsi hd drivers. Think of some overall generic device, a scanner for instance, it requires a major device number to handle the unique characteristics of scanners in general. Not specific scanners, scanners in general with their unique (but generic) command set.

The major device number for scsi hard drives (/dev/sda to infinity) is 64. The corresponding driver for '64' is sd_mod.o Short for sCSIdISK_modULE.o

The major device number for scsi cd's (/dev/scd0 to infinity) is 32. The corresponding driver for '32' is sr_mod.o Short for sCSICDrOM_modULE.o

The major device number 99 could be registered as spaghetti. Whatever spaggetti does, the kernel loads it. The point being the kernel has no interest in scsi, cd roms, hard drives or spaghetti. That functionality is entirely up to the module concerned.

sd_mod.o is a generic SCSI disk handler. sr_mod is a generic SCSI cd handler. They respectively handle an abstract command set of their own. "move head", "read track" etc. They massage these abstact commands into the scsi interface via another module scsi_mod.o

scsi_mod.o is generic. It provides another layer of abstraction between the different device type handlers (cd, hd, tape), and the actual card that does the work. In the steps provided, scsi_mod.o relies on the aha152x or the ncr53c810 driver to do the dirty work.

device_driver (sd_mod.o) ->  scsi driver (scsi_mod.o) -> card driver (aha152x.o) -> physical device

WHERE IT CONNECTS TOGETHER

modprobe aha152x <parms> loads the card driver (ie a driver capable of handling an AHA1510 cheap scsi). It discovers that this card driver relies on scsi_mod.o, and loads it too. scsi_mod.o relies on nothing. It doesn't care what talks to it.

Immediately after a modprobe, if you "lsmod", you will discover only two modules present, the aha, and the scsi.

It is only at the time of "mount"ing a device that the final piece to the puzzle fits in place. The major device number causes it's respective module to be loaded. Typing "lsmod" again, will reveal sr_mod (or sd_mod) are now loaded and information is also displayed where these modules are attached to each other.

It is well worth your time removing modules and attempting to "mount" devices and discovering the various error messages that occur. The mail groups are full of such messages due to these problems