496 lines
10 KiB
HTML
496 lines
10 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Drive Naming in Linux</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Partitions-Mass-Storage-Definitions-Naming-HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Definitions"
|
|
HREF="x35.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Partition Naming in Linux"
|
|
HREF="x160.html"></HEAD
|
|
><BODY
|
|
CLASS="section"
|
|
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"
|
|
>Partitions-Mass-Storage-Definitions-Naming-HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x35.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x160.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H1
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN99"
|
|
></A
|
|
>5. Drive Naming in Linux</H1
|
|
><P
|
|
>There is a special nomenclature that linux uses to refer
|
|
to mass storage that must be understood.</P
|
|
><DIV
|
|
CLASS="section"
|
|
><H2
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN102"
|
|
></A
|
|
>5.1. Naming Convention</H2
|
|
><P
|
|
>Linux used to deal with two kind of drives, depending
|
|
of the electronic interface (controller), IDE and SCSI.
|
|
Oldtimers remember the day where cdwriters where acccessed
|
|
through "SCSI emulation". In fact IDE and SCSI use mostly the
|
|
same low level commands and for 2007 up, with the new "SATA"
|
|
interface, the naming was unified and, in new ditributions,
|
|
all the drives have the same naming. For this part, CD or DVD
|
|
readers/writers are seen like Hard Drives.</P
|
|
><DIV
|
|
CLASS="section"
|
|
><H3
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN105"
|
|
></A
|
|
>5.1.1. Old IDE Names</H3
|
|
><P
|
|
>By convention, IDE drives where given device names
|
|
<FONT
|
|
COLOR="RED"
|
|
>/dev/hda</FONT
|
|
>to
|
|
<FONT
|
|
COLOR="RED"
|
|
>/dev/hdd</FONT
|
|
>.
|
|
<EM
|
|
>H</EM
|
|
>ard
|
|
<EM
|
|
>D</EM
|
|
>rive
|
|
<EM
|
|
>A</EM
|
|
>(
|
|
<FONT
|
|
COLOR="RED"
|
|
>/dev/hda</FONT
|
|
>) is the first drive and
|
|
<EM
|
|
>H</EM
|
|
>ard
|
|
<EM
|
|
>D</EM
|
|
>rive
|
|
<EM
|
|
>C</EM
|
|
>(
|
|
<FONT
|
|
COLOR="RED"
|
|
>/dev/hdc</FONT
|
|
>) is the third.</P
|
|
><P
|
|
>A typical PC has two IDE controllers, each of which
|
|
can have two drives connected to it. For example,
|
|
<FONT
|
|
COLOR="RED"
|
|
>/dev/hda</FONT
|
|
>is the first drive (master) on the
|
|
first IDE controller and
|
|
<FONT
|
|
COLOR="RED"
|
|
>/dev/hdd</FONT
|
|
>is the second (slave) drive on the
|
|
second controller (the fourth IDE drive in the
|
|
computer).</P
|
|
><P
|
|
>So, typically, a computer with IDE controller can
|
|
accomodate 4 drives: /dev/hda (primary master), /dev/hdb
|
|
(primary slave), /dev/hdc (secondary master), /dev/hdd
|
|
(secondary slave). Some (rare) Mother Boards have more than
|
|
two controllers, some addition cards can also have
|
|
controllers, these are numbered following the alphabet, but
|
|
one have to figure out what real names are given for his
|
|
particular hardware.</P
|
|
><P
|
|
>You can have drives where ever you want, it's not
|
|
mandatory to fill the gaps. You may have interest to read
|
|
about what drive/cdrom connect to what place, but it's out
|
|
of this document scope.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H3
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN123"
|
|
></A
|
|
>5.1.2. New Hard Drives Names</H3
|
|
><P
|
|
>Now all the rotating hard drives uses the same names
|
|
as the old SCSI controllers, that is "s" in place of "h",
|
|
so /dev/sda, and so on. The number of drives depends on the
|
|
number of controllers on the Mother Board or the extended
|
|
boards. Usually 4 are available. What will be the number of
|
|
a drive is up to the controller card and the way it's read
|
|
by the kernel, so difficult to say at first.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H3
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN126"
|
|
></A
|
|
>5.1.3. Flash Drives Names</H3
|
|
><P
|
|
>Flash drives are usually not connected through IDE or
|
|
SATA interfaces and so don't uses the same names. Several
|
|
interfaces are used with each different names. The kernel
|
|
documentations gives the names.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H3
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN129"
|
|
></A
|
|
>5.1.4. Low level Devices and Extra naming</H3
|
|
><P
|
|
>You will find in some apps references to lowlevel
|
|
SCSI devices and various naming conventions, for example
|
|
(wodim is the command line cd burner):</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> wodim --scanbus
|
|
scsibus1:
|
|
1,0,0 100) *
|
|
1,1,0 101) 'TSSTcorp' 'CD/DVDW TS-L632D' 'ac00' Removable CD-ROM
|
|
1,2,0 102) *
|
|
1,3,0 103) *
|
|
1,4,0 104) *
|
|
1,5,0 105) *
|
|
1,6,0 106) *
|
|
1,7,0 107) *
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>And you may have to use some sort of
|
|
<EM
|
|
>SCSI:1,1,0</EM
|
|
>option to access the CDROM.
|
|
try to avoid using this as much as possible, as it's very
|
|
error prone and should be let to programmers only. I only
|
|
mention it because you can't always avoid it.</P
|
|
><P
|
|
>If you do "cat /dev/ | more", you can see:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> lrwxrwxrwx 1 root root 3 mars 9 07:56 scd0 -> sr0
|
|
(...)
|
|
crw-r----- 1 root disk 21, 0 mars 9 07:56 sg0
|
|
crw-rw----+ 1 root disk 21, 1 mars 9 07:56 sg1
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>These scd, sr, sg devices are lowlevel interface
|
|
(notice the "c" for "character"). Try not using them.
|
|
<EM
|
|
>dmesg</EM
|
|
>and
|
|
<EM
|
|
>more /var/log/boot.msg</EM
|
|
>should give you
|
|
the usable sdxx device, like (short summary):</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <5>sd 0:0:0:0: [sda] 976773168 512-byte hardware sectors: (500GB/465GiB)
|
|
<5>sd 0:0:0:0: [sda] Write Protect is off
|
|
<7>sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>This mean the drive is
|
|
<EM
|
|
>/dev/sda</EM
|
|
>.</P
|
|
><P
|
|
>However these files (given by
|
|
<EM
|
|
>dmesg</EM
|
|
>and
|
|
<EM
|
|
>more /var/log/boot.msg</EM
|
|
>) used to be
|
|
easy to read but are no more. Now the kernel starts in
|
|
parallel several drivers, so the messages are mixed, you
|
|
can have</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <6> sda:<6>USB Universal Host Contr'ller Interface driver v3.0
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>This don't mean that your sda drive is an usb one,
|
|
but the usb module was started at the same time as the
|
|
drive one and send it's messages simultaneously. You still
|
|
have a
|
|
<EM
|
|
>/dev/sda</EM
|
|
>drive.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H3
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN149"
|
|
></A
|
|
>5.1.5. New Media Names</H3
|
|
><P
|
|
>Here the dmesg content for inserting an USB
|
|
key:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> scsi7 : SCSI emulation for USB Mass Storage devices
|
|
usb 5-3: New USB device found, idVendor=0951, idProduct=160e
|
|
usb 5-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
|
|
usb 5-3: Product: DataTraveler 2.0
|
|
usb 5-3: Manufacturer: Kingston
|
|
usb 5-3: SerialNumber: 200706200000000059188185
|
|
usb-storage: device found at 9
|
|
usb-storage: waiting for device to settle before scanning
|
|
scsi 7:0:0:0: Direct-Access Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 2
|
|
sd 7:0:0:0: [sdb] 3930112 512-byte hardware sectors: (2.01GB/1.87GiB)
|
|
sd 7:0:0:0: [sdb] Write Protect is off
|
|
sd 7:0:0:0: [sdb] Mode Sense: 23 00 00 00
|
|
sd 7:0:0:0: [sdb] Assuming drive cache: write through
|
|
sd 7:0:0:0: [sdb] 3930112 512-byte hardware sectors: (2.01GB/1.87GiB)
|
|
sd 7:0:0:0: [sdb] Write Protect is off
|
|
sd 7:0:0:0: [sdb] Mode Sense: 23 00 00 00
|
|
sd 7:0:0:0: [sdb] Assuming drive cache: write through
|
|
sdb: sdb1
|
|
sd 7:0:0:0: [sdb] Attached SCSI removable disk
|
|
sd 7:0:0:0: Attached scsi generic sg2 type 0
|
|
usb-storage: device scan complete
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>You see there all what we where speaking about right
|
|
now! SCSI emulation, scsi, sd and sg names, but also the
|
|
sdb that is most important for us.</P
|
|
><P
|
|
>Here are the messages for a high speed SDHC
|
|
card:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> tifm_core: MMC/SD card detected in socket 0:1
|
|
mmc1: new SDHC card at address d555
|
|
mmcblk0: mmc1:d555 SD04G 3.79GiB
|
|
mmcblk0: p1
|
|
|
|
/dev/mmcblk0p1 on /media/H2SD type vfat (rw,nosuid,nodev,noatime,flush,uid=1000,utf8,shortname=lower)
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>When the two cards are probably the same flash memory
|
|
chip, the USB key uses the USB interface and SCSI
|
|
emulation, the SDHC card uses the PCMCIA slot of the
|
|
laptop, with a special device naming (/dev/mmcblk0). The
|
|
use, as far as partitionning is involved is the
|
|
same.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="section"
|
|
><H3
|
|
CLASS="section"
|
|
><A
|
|
NAME="AEN157"
|
|
></A
|
|
>5.1.6. Disk ID</H3
|
|
><P
|
|
>In a world where disks are many and removable, it's
|
|
impossible to track what device is used by what disk. So
|
|
there are now many way of using a disk name. This makes it
|
|
extremely difficult to work with basic tools. These are
|
|
"Disk labels" and "Disk UUID", also "Partition Labels". See
|
|
fstab man page for details.</P
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><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="x35.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="x160.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Definitions</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Partition Naming in Linux</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |