\documentclass{cmlab}

\RCS $Revision: 1.3 $

\newcommand*{\labTitle}{Partitioning the hard disk}

\begin{document}
\section{Aim}
\label{sec:aim}

A hard disk needs to be divided into one or more sections called
\emph{partitions}.  We will install a number of operating systems onto
our hard disks.  Each operating system needs at least one partition.
We will use the Linux \texttt{fdisk} program to create these partitions today.
Later, in your subject \emph{Systems and Network Administration},
Albert will show you how to install Windows 2000 (and possibly Windows
NT) into some of these partitions.  Our aim for today is to create the
partitions necessary for installation of all these operating systems.

\section{Background}
\label{sec:background}


\subsection{Types of partition}
\label{sec:types}

On an \acro{IBM} \PC compatible, there are a few types of partition:

\noindent%
\begin{tabular}[t]{@{}lcl@{}}
\toprule%
\textbf{type} & \textbf{max number} & \textbf{location}\\
\midrule%
primary & 4 & outside of any other partition \\
extended & 1 & outside of any other partition \\
logical & no limit & inside an extended partition\\
\bottomrule
\end{tabular}

\vspace{2ex}

The total number of primary and extended partitions must be four or
less.

\subsection{Limitations of IBM PC BIOS}
\label{sec:limitations}

The computers we use are compatible with the original \acro{IBM} \PC.  The
\BIOS (Basic Input Output System) also remains compatible with the
original machine, and has the following limitations:

\noindent%
\begin{tabular}[t]{@{}lcc@{}}
\toprule%
\textbf{parameter} & \textbf{number of bits} & \textbf{maximum  value}\\
\midrule%
cylinders & 10  & 1023\\
heads & 8 & 255\\
sectors & 6 & 63\\
\bottomrule
\end{tabular}

\vspace{2ex}

To boot an operating system on a PC, the \BIOS must be able to load the
first part of the operating system.  The first part of the operating
system must be on a location on the hard disk within these
limitations.  In particular, the boot files of the operating system
must be entirely below cylinder 1024, or the computer may not be able
to boot.

\subsection{Disk and partition naming scheme in Linux}
\label{sec:naming-scheme}

The motherboards of the computers in the lab have two 40-pin \IDE
connectors: one is called the \emph{primary} \IDE bus, the other the
\emph{secondary}.  A ribbon cable connects to each of these
connectors.  There are two female sockets on each cable.  One connects
to a disk configured as the \emph{master}, the other to the
\emph{slave}.  Jumpers on the hard disk determine whether the disk is
the master or slave.

The naming scheme for the disks is:

\noindent%
\begin{tabular}[t]{@{}ccc@{}}
  \toprule%
  \textbf{name} & \textbf{primary/secondary} & \textbf{master/slave}\\
  \midrule%
  hda & primary & master \\
  hdb & primary & slave \\
  hdc & secondary & master \\
  hdd & secondary & slave\\
  \bottomrule
\end{tabular}

\vspace{2ex}

Partitions are named with the first three letters being that of the
hard disk.  Added to this is a number.  A primary partition may be
numbered 1 to 4 (i.e., on our hard disks, hda1, hda2, hda3 or hda4).
Logical partitions start with the number 5, so on hda, the logical
partitions are called hda5, hda6, hda7,\ldots

\subsection{Our partitioning scheme}
\label{sec:scheme}

The partitioning scheme we use here will look like
figure~\vref{fig:partitioning-scheme}.

\begin{figure}[htb]
  \centering%
  \noindent%
  \includegraphics[scale=0.7]{partitioning-scheme-ext}
  
  \caption{The partioning scheme we will use for our hard disk.}
  \label{fig:partitioning-scheme}  
\end{figure}

% \vspace{2ex}

We will create all these partitions today.

We will use the Linux installation procedure to run \texttt{fdisk} to
partition the removable hard disk.

\section{Procedure}
\label{sec:procedure}

\textbf{Hard disks are very delicate.}  Treat them as if they were
very fragile and very expensive (they are!).  \textbf{Never} plug or
unplug a removable hard disk in while the power is on.  Wait at least
fifteen seconds before putting the hard disk in or removing it from
the computer.
\begin{enumerate}
\item Either make a network boot floppy disk or take one from the
  technician or from the lecturer.

\item Install the removable hard disk.  This will be the master
  device on the primary IDE bus.

\item Put the floppy disk into the drive and reboot the machine.

\item The installation screen for Red Hat Linux will appear.

\item Accept defaults for language and keyboard.

  \begin{figure}[htb]
    \centering%
    \includegraphics[width=0.9\linewidth]{ftp}
    \caption{The screen where you select using FTP for the network
      installation method.}
    \label{fig:ftp}
  \end{figure}
\item For installation type, select \textsf{FTP}.  See
  figure~\vref{fig:ftp}.

  \begin{figure}[htb]
    \centering%
    \includegraphics[width=0.9\linewidth]{dhcp-choose}
    \caption{The screen where you select using DHCP for TCP/IP parameters.}
    \label{fig:dhcp-config}
  \end{figure}
  
\item When asked for the IP address of the computer, select
  \textsf{Use DHCP} by pressing the space bar.  See
  figure~\vref{fig:dhcp-config}.

\item For address of the server, put \texttt{CSAlinux}

\item For directory of the installation, put \texttt{pub/CSAlinux} \hspace{2ex}
  See figure~\ref{fig:select-csalinux}.
  \begin{figure}[htb]
    \centering%
    \includegraphics[width=0.9\linewidth]{select-csalinux}
    \caption{The screen where you select the server to do the network
      installation from.}
    \label{fig:select-csalinux}
  \end{figure}


\item When asked what disk you want to install on, select
  \textsf{/dev/hda}.  This is \textbf{very important}; do not
  partition \textsf{/dev/hdc}, or Patrick the technician will need to
  stay back and re-install the operating system for the other classes;
  he will be very upset!!!  \emph{Be very careful}.

\item The lecturer will demonstrate the partitioning procedure.  Make
  sure that you \textbf{ask questions} if you are unsure.  If you make a
  mistake and partition the wrong hard disk, you will upset many
  people.

  The common \texttt{fdisk} commands that you will use are:

  \noindent%
  \begin{tabularx}{\linewidth}[t]{@{}clY@{}}
    \toprule%
    \textbf{command} & \textbf{name} & \textbf{action}\\
    \midrule%
    \texttt{m} & menu & show a list of all the commands\\
    \texttt{p} & print & display the partition table\\
    \texttt{n} & new partition & create a new partition\\
    \texttt{d} & delete & delete a partition (good if you make a
    mistake!)\\
    \texttt{a} & active & make a partition active\\
    \texttt{q} & quit & exit \textbf{without saving} the table.  Great
    if you really mess it up!\\
    \texttt{w} & write & Write changes to the disk.  \texttt{w}.  After
    that, it's very hard to undo your changes, so thing three times
    before pressing \texttt{w}.\\
    \bottomrule
  \end{tabularx}
\end{enumerate}

\end{document}
