Previous Next Contents

3. What Are The Requirements To Use It?

3.1 Kernel Configuration

You must have a supported SCSI controller, obviously. Furthermore, your kernel must have controller support as well as generic support compiled in. Configuring the Linux kernel (via make config under /usr/src/linux) typically looks like the following:

 ...
*
* SCSI support
*
SCSI support? (CONFIG_SCSI) [n] y
*
* SCSI support type (disk, tape, CDrom)
*
 ...
Scsi generic support (CONFIG_CHR_DEV_SG) [n] y
*
* SCSI low-level drivers
*
 ...

If available, modules can of course be build instead.

3.2 Device Files

The generic SCSI driver uses its own device files, separate from those used by the other SCSI device drivers. They can be generated using the MAKEDEV script, typically found in the /dev directory. Running MAKEDEV sg produces these files:

crw-------   1 root     system    21,   0 Aug 20 20:09 /dev/sga
crw-------   1 root     system    21,   1 Aug 20 20:09 /dev/sgb
crw-------   1 root     system    21,   2 Aug 20 20:09 /dev/sgc
crw-------   1 root     system    21,   3 Aug 20 20:09 /dev/sgd
crw-------   1 root     system    21,   4 Aug 20 20:09 /dev/sge
crw-------   1 root     system    21,   5 Aug 20 20:09 /dev/sgf
crw-------   1 root     system    21,   6 Aug 20 20:09 /dev/sgg
crw-------   1 root     system    21,   7 Aug 20 20:09 /dev/sgh
                                   |    |
                               major,   minor device numbers

Note that these are character devices for raw access. On some systems these devices may be called /dev/{sg0,sg1,...}, depending on your installation, so adjust the following examples accordingly.

3.3 Device Mapping

These device files are dynamically mapped to SCSI id/LUNs on your SCSI bus (LUN = logical unit). The mapping allocates devices consecutively for each LUN of each device on each SCSI bus found at time of the SCSI scan, beginning at the lower LUNs/ids/buses. It starts with the first SCSI controller and continues without interruption with all following controllers. This is currently done in the initialisation of the SCSI driver.

For example, assuming you had three SCSI devices hooked up with ids 1, 3, and 5 on the first SCSI bus (each having one LUN), then the following mapping would be in effect:

/dev/sga -> SCSI id 1
/dev/sgb -> SCSI id 3
/dev/sgc -> SCSI id 5

If you now add a new device with id 4, then the mapping (after the next rescan) will be:

/dev/sga -> SCSI id 1
/dev/sgb -> SCSI id 3
/dev/sgc -> SCSI id 4
/dev/sgd -> SCSI id 5

Notice the change for id 5 -- the corresponding device is no longer mapped to /dev/sgc but is now /dev/sgd.

Rescanning the devices

To force a rescan, a modularized driver could be deleted and reinserted. At initialisation time it will rescan its bus. But in order to be able to delete the driver, none of its devices may be in use at that time. When adding more devices to the scsi bus keep in mind there are limited spare entries for new devices. The memory had been allocated at boot time and has room for 2 more devices.

Scanning the scsi buses on your own for all luns is not recommended. There are too many (buggy) devices that may hang the scsi bus, when being addressed with a LUN value that is not 0. The kernel manages a private table with known flawed devices, where it scans with LUN 0 only. Newer kernels scan at default with lun 0 only.


Previous Next Contents