Whole document tree
    

Whole document tree

Drives and devices

Drives and devices

Under UNIX, the word "device" is used for all peripheral devices connected to your computer; this includes hard drives, floppy and CD-ROM drives, audio and video cards, serial and parallel ports, and much more. Each device has a name, such as /dev/hda. The most common device names are listed below (for Linux; other varieties of UNIX may use slightly different device names).

  • /dev/hd* (where *=a,b,c, …): these are IDE devices, such as hard drives, CD-ROM drives and ZIP drives. /dev/hda denotes the master drive on the first IDE controller (usually your first hard drive, C: under Windows), /dev/hdb is the slave drive on the fist controller (this can be a second hard drive or a CD-ROM), and so on. See also the note below about ZIP drives.

  • /dev/sd* (where *=a,b,c, …): these are SCSI devices, usually hard drives.

NoteNOTE
 

If the acronyms IDE and SCSI are new to you, here is a brief explanation: there are two types of interfaces for hard drives and other similar devices: IDE (and its cousins such as EIDE, ATAPI, etc.) and SCSI. SCSI provides better performance, but is more expensive, so it is only used on servers. If you are not sure what kind of drives you have, most probably it is IDE.

  • /dev/fd* (where *=0,1, etc) are floppy drives; /dev/fd0 is the first drive (it corresponds to A: under Windows), /dev/fd1 is the second (B:), etc.

  • /dev/lp* (where *=0,1, etc) are parallel ports; most commonly, these ports are used to connect a printer to the computer. /dev/lp0 corresponds to LPT1 under Windows, /dev/lp1 to LPT2, etc.

  • /dev/ttyS* (where *=0,1, etc) are serial ports; these ports are commonly used for connecting a mouse or a modem. /dev/ttyS0 corresponds to COM1 under Windows, /dev/ttyS1 to COM2, etc.

  • /dev/audio and /dev/dsp — these two device names are used for your audio card (they are not equivalent, since they are used for different types of audio files).

In addition, it is a common practice to have symlinks /dev/floppy, /dev/modem and /dev/cdrom pointing to the actual device name corresponding to your floppy drive, modem, and CD-ROM drive respectively.

You rarely need to use these device names. In particular, if you want to access a file on a drive, you do not use the device name (such as /dev/fd0); instead, you first mount the device so that its contents shows as a subdirectory (for example, /mnt/floppy) in the main directory tree, and then use this directory for accessing files; see the section called Mounting and unmounting drives for more information. About the only time when you actually need to use the device names is when you are configuring some newly installed program. For example, a fax program can ask you for the device name for your modem (in which case you can either give it the actual device name, such as /dev/ttyS1, or just use the symlink /dev/modem).

And just for fun: there is also a device /dev/null which acts as a "black hole": you can send to it any information, and it never returns. So if you do not want to be bothered by error messages, re-direct them to /dev/null -:).

Partitions

Note that it is possible to subdivide a hard drive (or a similar device) into parts which for all practical purposes behave as independent disks, even though physically they reside on the same disk. These parts are called "partitions" (under Windows, the name "logical disk" is used). For example, you can partition your hard drive into several partitions, and install different operating systems in different partitions; you can reformat each partition independently of the others. This partitioning of the hard drive is usually done during the installation of the operating system; refer to your installation guide for more information.

If your hard drive has been partitioned then each partition is considered as a separate device. For example, if your hard drive is /dev/hda, then the first partition on this drive would be referred to as /dev/hda1, the second as /dev/hda2, and so on.

WarningPartitioning of ZIP disks
 

For reasons unknown to us, the pre-formatted ZIP disks sold in stores or formatted using Iomega's ZIP tools under Windows are partitioned in a strange way: they have only one partition (of Windows type, of course), but this partition has number 4. Thus, if your ZIP drive is /dev/hdc, the correct device name you should use for such disks is /dev/hdc4.