old-www/HOWTO/SCSI-2.4-HOWTO/dnames.html

442 lines
7.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Device Names</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Linux 2.4 SCSI subsystem HOWTO"
HREF="index.html"><LINK
REL="UP"
TITLE="Names and Addresses"
HREF="names.html"><LINK
REL="PREVIOUS"
TITLE="SCSI Addressing"
HREF="scsiaddr.html"><LINK
REL="NEXT"
TITLE="Device Names in devfs"
HREF="dnamesdevfs.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux 2.4 SCSI subsystem HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="scsiaddr.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Names and Addresses</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="dnamesdevfs.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="dnames"
></A
>3.2. Device Names</H1
><P
>&#13;A device name can be thought of as a gateway to a kernel driver that
controls a device rather than the device itself. Hence there can be
multiple device names some of which may offer slightly different
characteristics, all mapping to the same actual device.
</P
><P
>&#13;The device names of the various SCSI devices are found within the
<TT
CLASS="filename"
>/dev</TT
> directory. Traditionally in Linux, SCSI
devices have been identified by their major and minor device number
rather than their SCSI bus addresses (e.g. SCSI target id and LUN).
The device pseudo file system (devfs) moves away from the major and
minor device number scheme and for the SCSI subsystem uses device names
based on the SCSI bus addresses [discussed later in
<A
HREF="dnamesdevfs.html"
>Section 3.3</A
> and see reference: <A
HREF="refs.html#W5"
>W5</A
>].
Alternatively, there is a utility called <B
CLASS="command"
>scsidev</B
>
which addresses this issue within the scope of the Linux SCSI subsystem
and thus does not have the same system wide impact as devfs. Scsidev is
discussed later in <A
HREF="dnamesscsidev.html"
>Section 3.4</A
> and ref:
<A
HREF="refs.html#W6"
>W6</A
>.
</P
><P
>&#13;Eight block major numbers are reserved for SCSI disks: 8, 65, 66, 67, 68,
69, 70 and 71. Each major can accommodate 256 minor numbers which, in the
case of SCSI disks, are subdivided as follows:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;[b,8,0] /dev/sda
[b,8,1] /dev/sda1
....
[b,8,15] /dev/sda15
[b,8,16] /dev/sdb
[b,8,17] /dev/sdb1
....
[b,8,255] /dev/sdp15
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;The disk device names without a trailing digit refer to the whole disk
(e.g. <TT
CLASS="filename"
>/dev/sda</TT
>)
while those with a trailing digit refer to one of the 15 allowable
partitions
<A
NAME="AEN172"
HREF="#FTN.AEN172"
><SPAN
CLASS="footnote"
>[1]</SPAN
></A
>
within that disk.
</P
><P
>&#13;The remaining 7 SCSI disk block major numbers follow a similar pattern:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;[b,65,0] /dev/sdq
[b,65,1] /dev/sdq1
....
[b,65,159] /dev/sdz15
[b,65,160] /dev/sdaa
[b,65,161] /dev/sdaa1
....
[b,65,255] /dev/sdaf15
[b,66,0] /dev/sdag
[b,66,1] /dev/sdag1
....
[b,66,255] /dev/sdav15
....
[b,71,255] /dev/sddx15
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;So there are 128 possible disks (i.e. <TT
CLASS="filename"
>/dev/sda</TT
> to
<TT
CLASS="filename"
>/dev/sddx</TT
>) each having up
to 15 partitions. By way of contrast, the IDE subsystem allows 20 disks
(10 controllers each with 1 master and 1 slave) which can have up to 63
partitions each.
</P
><P
>&#13;SCSI CD-ROM devices are allocated the block major number of 11. Traditionally
<TT
CLASS="filename"
>sr</TT
> has been the device name but <TT
CLASS="filename"
>scd</TT
>
probably is more recognizable and is
favoured by several recent distributions. 256 SCSI CD-ROM devices are
allowed:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;[b,11,0] /dev/scd0 [or /dev/sr0]
[b,11,255] /dev/scd255 [or /dev/sr255]
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;SCSI tape devices are allocated the char major number of 9. Up to 32 tape
devices are supported each of which can be accessed in one of four modes
(0, 1, 2 and 3), with or without rewind. The devices are allocated as
follows:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;[c,9,0] /dev/st0 [tape 0, mode 0, rewind]
[c,9,1] /dev/st1 [tape 1, mode 0, rewind]
....
[c,9,31] /dev/st31 [tape 31, mode 0, rewind]
[c,9,32] /dev/st0l [tape 0, mode 1, rewind]
....
[c,9,63] /dev/st31l [tape 31, mode 1, rewind]
[c,9,64] /dev/st0m [tape 0, mode 2, rewind]
....
[c,9,96] /dev/st0a [tape 0, mode 3, rewind]
....
[c,9,127] /dev/st31a [tape 31, mode 3, rewind]
[c,9,128] /dev/nst0 [tape 0, mode 0, no rewind]
....
[c,9,160] /dev/nst0l [tape 0, mode 1, no rewind]
....
[c,9,192] /dev/nst0m [tape 0, mode 2, no rewind]
....
[c,9,224] /dev/nst0a [tape 0, mode 3, no rewind]
....
[c,9,255] /dev/nst31a [tape 31, mode 3, no rewind]
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;The SCSI generic (sg) devices are allocated the char major number of 21.
There are 256 possible SCSI generic (sg) devices:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="programlisting"
>&#13;[c,21,0] /dev/sg0
[c,21,1] /dev/sg1
....
[c,21,255] /dev/sg255
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13;Note that the SCSI generic device name's use of a trailing letter (e.g.
<TT
CLASS="filename"
>/dev/sgc</TT
>) is deprecated.
</P
><P
>&#13;Each SCSI disk (but not each partition), each SCSI CD-ROM and each SCSI
tape is mapped to an sg device. SCSI devices that don't fit into these
three categories (e.g. scanners) also appear as sg devices.
</P
><P
>&#13;Pseudo devices [see <A
HREF="llevelpseudo.html"
>Section 10.1</A
>] can cause devices
that are usually not considered as SCSI to appear as SCSI device names.
For example an ATAPI CD-ROM may be picked up by the ide-scsi pseudo
driver and mapped to <TT
CLASS="filename"
>/dev/scd0</TT
> .
</P
><P
>&#13;The <TT
CLASS="filename"
>linux/Documentation/devices.txt</TT
> file supplied
within the kernel source is the definitive reference for Linux device
names and their corresponding major and minor number allocations.
</P
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN172"
HREF="dnames.html#AEN172"
><SPAN
CLASS="footnote"
>[1]</SPAN
></A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>&#13;If 15 partitions is too limiting then the Logical Volume Manager (LVM)
might be considered. See <TT
CLASS="filename"
>/usr/src/linux/Documentation/LVM-HOWTO
</TT
>. LVM will also allow a logical partition to span multiple
block devices.
</P
></TD
></TR
></TABLE
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="scsiaddr.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="dnamesdevfs.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SCSI Addressing</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="names.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Device Names in devfs</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>