Previous Next Contents

11. Assignment of minor numbers

Due to constraints imposed by Linux's use of a sixteen bit dev_t with only eight bits allocated to the minor number, SCSI disk, tape, CDROM, and generic minor numbers are assigned dynamically. according to the following procedure :

For all SCSI host adapters, from scsi0 through scsiN
    For all SCSI IDs on this bus, from 0 through 7, except for 
      this host adapter's ID
        For all logical units, from 0 through max_scsi_luns
          - Probe the bus, target, and LUN combination by 
            issuing a TEST UNIT READY command.  If we don't
            think a unit was here, don't probe any more LUNs
            on this bus + SCSI ID.
          - Send an INQUIRY command to determine what we've
            found; including the device type, vendor, model,
            firmware revision, etc.
          - Pass the results of this to a special recognition
            function for each high level driver present (i.e. disk,
            tape, etc).  Attach this device to the next available
            unit for any drivers that are willing to drive this.
            The generic device will attach to all devices.
          - If it was SCSI-I, or in a list of devices known 
            not to handle multiple LUNs, don't probe any more 
            LUNs on this bus + SCSI ID.
          - If it is a device known to have multiple LUNs, then
            a scan of the full LUN spectrum is forced, overriding
            max_scsi_luns.

There are frequently problems with this approach because if you have a system where some devices are only present some of the time, then the minor numbers for a given device will depend upon which devices were present at boot time. This can present problem, because rc scripts or the file /etc/fstab might contain instructions for mounting specific partitions which fails when the disk appears with a different minor number.

This problem has not yet been fully solved. There is a program which can be found on tsx-11 that creates a /dev/scsi hierarchy based upon host number, id and lun. This is a bit clumsy, but it would help to alleviate some of the problems.

A better solution will probably come out of the /proc/scsi pseudo directory. This is currently a work in progress, so at present we cannot say exactly the form of the solution, but at the time of this writing this appears to be a promising approach for resolving some of these issues.


Previous Next Contents