2.3.4 Device Names in Linux

Linux disks and partition names may be different from those in other operating systems. You should know the names that Linux uses when you create and mount partitions. The basic scheme can be found in Table 2.1 on page 34.


Table 2.1: Linux Device Names


Device

Linux Name




First floppy drive

/dev/fd0


Second floppy drive

/dev/fd1


First partition on /dev/hda (typically C: in other OSs)

/dev/hda1


Fifth partition on /dev/hdc

/dev/hdc5


Second partition on /dev/sdb

/dev/sdb2


Entire Primary-Master IDE hard disk or CD-ROM

/dev/hda


Entire Primary-Slave IDE hard disk or CD-ROM

/dev/hdb


Entire Secondary-Master IDE hard disk or CD-ROM

/dev/hdc


Entire Secondary-Slave IDE hard disk or CD-ROM

/dev/hdd


First SCSI disk

/dev/sda


Second and remaining SCSI disks

/dev/sdb and so forth


First serial port (COM1 in other OSs)

/dev/ttyS0


Second, third, etc. serial ports

/dev/ttyS1, /dev/ttyS2, etc.


SCSI tape units (automatic rewind)

/dev/st0, /dev/st1, etc.


SCSI tape units (no automatic rewind)

/dev/nst0, /dev/nst1, etc.


SCSI CD-ROMs

/dev/scd0, /dev/scd1, etc.



The partitions on each disk are represented by appending a number to the disk name. For example, the names hda1 and hda2 represent the first and second partitions of the first IDE disk drive in your system. Linux represents the primary partitions with the drive name plus the numbers 1 through 4. For example, the first primary partition on the first IDE drive is /dev/hda1. The logical partitions are numbered starting at 5, so the first logical partition on that same drive is /dev/hda5. Remember that the extended partition – that is, the primary partition holding the logical partitions – is not usable by itself. This applies to SCSI drives as well as IDE drives.

Let’s assume you have a system with two SCSI disks, one at SCSI address 2 and the other at SCSI address 4. The first disk (at address 2) is then named sda and the second sdb. If the sda drive has three partitions on it, these will be named sda1, sda2, and sda3. The same applies to the sdb disk and its partitions. Note that if you have two SCSI host bus adapters (i.e., controllers), the order of the drives can get confusing. The best solution in this case is to watch the boot messages, assuming you know the drive models.