LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author]
  From: Daryl Tester <Daryl.Tester@steadycom.com.au>
  To  : idavid@smug.adelaide.edu.au
  Date: Thu, 20 May 1999 16:23:56 +0930 (CST)

Re: SCSI Confusion

David Drury wrote:

> /dev has sd[a-g][1-15] and sg[a-h], but there is confusion as to how it
> resolves to Partition and SCSI ID. Some indicate it the letters, and some
> the numbers.

/dev/sd* usually denotes the SCSI disk driver, while /dev/sg* is the
"generic" SCSI driver (can be used to access devices like scanners,
etc ...).  However, it's not so much the name that indicates the drive
and its partition, but the major and minor device numbers.  To wit:

[dt@dt dt]$ ls -l /dev/sda*
brw-rw----   1 root     disk       8,   0 Sep 13  1994 /dev/sda
brw-rw----   1 root     disk       8,   1 Sep 13  1994 /dev/sda1
brw-rw----   1 root     disk       8,   2 Sep 13  1994 /dev/sda2
brw-rw----   1 root     disk       8,   3 Sep 13  1994 /dev/sda3
brw-rw----   1 root     disk       8,   4 Sep 13  1994 /dev/sda4
brw-rw----   1 root     disk       8,   5 Sep 13  1994 /dev/sda5
brw-rw----   1 root     disk       8,   6 Sep 13  1994 /dev/sda6
brw-rw----   1 root     disk       8,   7 Sep 13  1994 /dev/sda7
brw-rw----   1 root     disk       8,   8 Sep 13  1994 /dev/sda8
brw-rw----   1 root     disk       8,   9 Sep 13  1994 /dev/sda9
[...]

See the "8, 0" part?  These are special files that map onto the
kernel's device drivers; the "8" is the major number and the
following number is the minor number (caveat:  I'm running a
RedHat 4.2 box here; these numbers may change between kernel
revisions).  A "man 4 sd" (under 4.2) shows how the minor device
number maps onto a SCSI drive and partition.

Note that the drive number is usually determined by detection at
boot up time, so if you have an external drive switched off when
your kernel probes for SCSI devices, not only will the drive not
exist if you power it up later, but if its ID occurs "lower down"
than the other drives you will find your drives suddenly mysteriously
shifting.


Cheers,
  Daryl Tester.        (http://www.steadycom.com.au/)
  Steadycom Pty. Ltd.  (Phone: +618 8202 9000  Fax: +618 8202 9001)
                    "Better dead than Redmond."

-- 
Check out the LinuxSA web pages at http://www.linuxsa.org.au/
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author]
Return to the LinuxSA Mailing List Information Page