% Linux Installation and Getting Started    -*- TeX -*-
% partition.tex
% Copyright (c) 1992-1994 by Matt Welsh <mdw@sunsite.unc.edu>
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by the 
% copyright for the entire document, in the file "copyright.tex".

\subsection{Drives and partitions under Linux}
\namedlabel{sec-install-linux-partition}{Drives and partitions under Linux}

\index{partitions!Linux|(}

Many distributions require you to create Linux partitions by hand using
the {\tt fdisk} program. Others may automatically create partitions for
you. Either way, you should know the following information about
Linux partitions and device names.

Drives and partitions under Linux are given different names than their
counterparts under other operating systems. Under MS-DOS, floppy drives are 
referred to as 
{\tt A:} and {\tt B:}, while hard drive partitions are named {\tt C:}, 
{\tt D:}, and so on. Under Linux, the naming convention is quite 
different.

{\bf Device drivers}, found in the directory {\tt /dev}, are used to 
communicate with devices on your system (such as hard drives, mice, and so on).
For example, if you have a mouse on your system, you access it through the 
driver {\tt /dev/mouse}. Floppy drives, hard drives, and individual partitions 
are all given individual device drivers of their own. Don't worry about 
the device driver interface for now; it is important only to understand how 
the various devices are named in order to use them.

Table~\ref{table-part-names} lists the names of these various device drivers.
\begin{table}[ht]\begin{center}
\small\begin{tabular}{ll}
\hline 
Device                                   & Name \\ 
\hline 
First floppy ({\tt A:})                  & {\tt /dev/fd0}  \\
Second floppy ({\tt B:})                 & {\tt /dev/fd1}  \\
First hard drive (entire drive)          & {\tt /dev/hda}  \\
First hard drive, primary partition 1    & {\tt /dev/hda1} \\
First hard drive, primary partition 2    & {\tt /dev/hda2} \\
First hard drive, primary partition 3    & {\tt /dev/hda3} \\
First hard drive, primary partition 4    & {\tt /dev/hda4} \\
First hard drive, logical partition 1    & {\tt /dev/hda5} \\
First hard drive, logical partition 2    & {\tt /dev/hda6} \\
$\vdots$ & \\
Second hard drive (entire drive)         & {\tt /dev/hdb} \\
Second hard drive, primary partition 1   & {\tt /dev/hdb1} \\
$\vdots$ & \\
First SCSI hard drive (entire drive)     & {\tt /dev/sda} \\
First SCSI hard drive, primary partition 1 & {\tt /dev/sda1} \\
$\vdots$ & \\
Second SCSI hard drive (entire drive)    & {\tt /dev/sdb} \\
Second SCSI hard drive, primary partition 1 & {\tt /dev/sdb1} \\
$\vdots$ & 
\end{tabular}\normalsize\rm
\caption{Linux partition names}
\label{table-part-names}
\end{center}\end{table}

A few notes about this table. Note that {\tt /dev/fd0} corresponds to the 
first floppy drive ({\tt A:} under MS-DOS) and {\tt /dev/fd1} corresponds to 
the second floppy ({\tt B:}).

Also, SCSI hard drives are named differently than other drives. IDE, MFM,
and RLL drives are accessed through the devices {\tt /dev/hda}, 
{\tt /dev/hdb}, and
so on. The individual partitions on the drive {\tt /dev/hda} are  
{\tt /dev/hda1}, {\tt /dev/hda2}, and so on. However, SCSI drives are named 
{\tt /dev/sda}, {\tt /dev/sdb}, etc., with partition names such as
{\tt /dev/sda1} and {\tt /dev/sda2}.

Here's an example. Let's say that you have a single IDE hard drive,
with 3 primary partitions. The first two are set aside for MS-DOS, and the
third is an extended partition which contains two logical partitions, both 
for use by Linux. The devices referring to these
partitions would be:

\small\begin{tabular}{ll} 
First MS-DOS partition ({\tt C:})     & {\tt /dev/hda1} \\
Second MS-DOS partition ({\tt D:})    & {\tt /dev/hda2} \\
Extended partition                    & {\tt /dev/hda3} \\
First Linux logical partition         & {\tt /dev/hda5} \\
Second Linux logical partition        & {\tt /dev/hda6} 
\end{tabular}\normalsize\rm\medskip

Note that {\tt /dev/hda4} is skipped; it corresponds to the fourth
primary partition, which we don't have in this example.
Logical partitions are named consecutively starting with {\tt /dev/hda5}.

\index{partitions!Linux|)}
