9.1 SunOS 4.1.X
SCSI-1 and SCSI-2 allow cable lengths totalling up to 6 meters, including internal cabling. Differential SCSI allows longer cable lengths, up to 25 meters. You can't directly mix differential and single-ended (classical) SCSI devices on the same SCSI bus without special translation devices.
SCSI devices are daisy-chained, and should be terminated on both ends of the chain. Classical SCSI uses passive terminators. Fast SCSI requires active terminators. These use voltage regulation to provide a more consistent termination resistance. Differential SCSI uses passive termination, but a different kind from classical SCSI.
The classical SCSI bus can accommodate 8 target devices, numbered 0 through 7. The last number, 7, is reserved for the connection between the bus and the system itself. Of the remaining seven the Sun kernel configuration file (SunOS 4.1.X) assumes that the first four will be used by disk devices, the next two by tape devices, and the last for a CDROM device, i.e.:
Wide SCSI allows 16 target devices, 0 through 15, with 15 the target ID of the host adaptor.
The larger the device number, the higher the priority of the device.
Only two SCSI devices can communicate at a time. So when a slow device is communicating with the host, i.e. a tape drive, the bus is effectively slowed down to the speed of the tape drive. When the tape drive is not in use the bus can resume a higher transfer rate of another device.
Earlier we mentioned that to boot a Sun4c machine from CDROM you would specify sd(0,6,2), or for a Sun4 machine you would specify sd(0,30,1) to the boot PROM. We will now look at where these numbers come from. As an example we look at sd(0,30,1).
FIGURE 9.1 SCSI Device Designation
SCSI devices may have their own controller to control a series of devices within the cabinet. For example you may have a cabinet with a controller and two disks that it controls. These external controllers can have 2 disks/target device; embedded controllers are limited to 1 disk/target device. Most SCSI devices today have embedded controllers, so you have one device for each SCSI ID on the Bus. Non-embedded devices are still available and may become more popular as the faster SCSI-2 protocol takes hold.
Sun's SCSI numbering scheme originated when non-embedded, external controller, devices were popular. One of their first products was called the "Shoebox" which had one controller to manage two disks, or a disk and tape drive. So when they mentioned disk drives as sd0 and sd1 they were talking about disks with the same SCSI host interface, but with different logical unit numbers, both with SCSI ID 0, but drive numbers 0 and 1. As embedded controllers became the norm, people generally referred to sd0 as the disk at SCSI ID 0 and sd1 as the disk at SCSI ID 1. But this is wrong, as they were both attached to the same SCSI controller. By using the drive number to specify both the SCSI ID and the disk number Sun was confusing people. Later Sun began using 3 octal numbers to represent the SCSI devices in the kernel configuration file, e.g.:
disk sd3 at sc0 drive 011 flags 0
Here, in 011, the first number, 0, represents the SCSI interface number, the second number, 1, indicates the SCSI controller (target ID), and the last number, 1, indicates the drive number. A flag of 0 indicates a disk device, and 1 a tape device.
With embedded controllers the drive number is always 0, so people tend to refer to the device by it's SCSI target ID only, further confusing the issue.
The following tables map out the relationship between SCSI target ID and Unix disk number. In these tables LUN stands for logical unit number
External Controller | Target ID | 0 | 1 | 2 | 3 | ||||
---|---|---|---|---|---|---|---|---|---|
LUN | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | |
UNIX sd# | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
Embedded Controller | Target ID | 0 | 1 | 2 | 3 | ||||
LUN | 0 | 0 | 0 | 0 | |||||
UNIX sd# | 0 | 2 | 4 | 6 |
Target ID | 0 | 1 | 2 | 3 | 4 | 5 | 6 | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LUN | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | NA | 0 | NA | 0 | NA |
SCSI Drive # | 0 | 1 | 8 | 9 | 16 | 17 | 24 | 25 | 32 | 40 | 48 | |||
SCSI Hex# | 0 | 1 | 8 | 9 | 10 | 11 | 18 | 19 | 20 | 28 | 30 | |||
UNIX sd# | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | st0 | st1 | sr0 |
To go back to our example then, we see from the second table that the CDROM device at SCSI target ID 6, sr0, has the number 3016, so to boot from the second file on this device we would use: sd(0,30,1).