% Linux Installation and Getting Started    -*- TeX -*-
% linux-req.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{Linux partition requirements}
\namedlabel{sec-install-swap}{Linux partition requirements}
\namedlabel{sec-install-linux-reqs}{Linux partition requirements}

Before we explain how to repartition your drives, you need to have an 
idea of how much space you will be allocating for Linux. We will be
discussing how to create these partitions later, in 
Section~\ref{sec-install-linux-fdisk}.

On UNIX systems, files are stored on a {\bf filesystem}, which is 
\index{filesystems}
essentially a section of the hard drive (or other medium, such as CD-ROM
or diskette) formatted to hold files. Each filesystem is associated with
a specific part of the directory tree; for example, on many systems,
there is a filesystem for all of the files in the directory {\tt /usr}, another
for {\tt /tmp}, and so on. The {\bf root filesystem} is the primary
filesystem, which corresponds to the topmost directory, {\tt /}. 
\index{root filesystem}
\index{filesystems!root}

Under Linux, each filesystem lives on a separate partition on the hard
drive. For instance, if you have a filesystem for {\tt /} and another
for {\tt /usr}, you will need two partitions to hold
the two filesystems. 

Before you install Linux, you will need to prepare filesystems for
storing the Linux software. You must have at least one filesystem (the
root filesystem), and therefore one partition, allocated to Linux.
Many Linux users opt to store all of their files on the root filesystem,
which is in most cases easier to manage than several filesystems and
partitions. 

However, you may create multiple filesystems for Linux if
you wish---for example, you may want to use separate filesystems for
{\tt /usr} and {\tt /home}. Those readers with UNIX system administration
experience will know how to use multiple filesystems creatively. In
Chapter~\ref{chap-sysadm-num} we discuss the use of multiple partitions
and filesystems.

\index{filesystems}
Why use more than one filesystem? The most commonly stated reason is
safety; if, for some reason, one of your filesystems is damaged,
the others will (usually) be unharmed. On the other hand, if you store
all of your files on the root filesystem, and for some reason the 
filesystem is damaged, then you may lose all of your files in one fell
swoop. This is, however, rather uncommon; if you backup the system
regularly you should be quite safe.\footnote{The author uses a single 
200-megabyte filesystem for all of his Linux files, and hasn't had any
problems (so far).}

Another reason to use multiple filesystems is to divvy up storage between
multiple hard drives. If you have, say, 40 megabytes free on one hard drive,
and 50 megabytes free on another, you might want to create a 40-megabyte root 
filesystem on the first drive and a 50-megabyte {\tt /usr} filesystem on the 
other. Currently it is not possible for a single filesystem to span multiple
drives; if your free hard drive storage is fragmented between drives you
will need to use multiple filesystems to utilize it all.

\index{partitions}
In summary, Linux requires at least one partition, for the root filesystem. 
If you wish to create multiple filesystems, you will need a separate 
partition for each additional filesystem. Some distributions of Linux
automatically create partitions and filesystems for you, so you may not need
to worry about these issues at all.

Another issue to consider when planning your partitions is swap space.
\index{swap space}
If you wish to use swap space with Linux, you have two options. The
first is to use a {\em swap file\/} which exists on one of your Linux
filesystems. You will create the swap file for use as virtual RAM after
you install the software. The second option is to create a 
{\em swap partition}, an individual partition to be used only as swap
space. Most people use a swap partition instead of a swap file.
\index{swap file}

A single swap file or partition may be up to 16 megabytes in size. If
you wish to use more than 16 megabytes of swap, you can create multiple
swap partitions or files---up to eight in all. For example, if you need
32 megabytes of swap, you can create two 16-megabyte swap partitions. 

Setting up a swap partition is covered in 
Section~\ref{sec-install-linux-mkswap}, and setting up a swap file in 
Chapter~\ref{chap-sysadm-num}.

Therefore, in general, you will create at least two partitions for Linux:
one for use as the root filesystem, and the other for use as swap space.
There are, of course, many variations on the above, but this is the
minimal setup. You are not required to use swap space with Linux, but if
you have less than 16 megabytes of physical RAM it is strongly 
suggested that you do.

Of course, you need to be aware of how much {\em space\/} these partitions
will require. The size of your Linux filesystems (containing the software
itself) depends greatly on how much software you're installing and
what distribution of Linux you are using. Hopefully, the documentation
that came with your distribution will give you an approximation of the
space requirements. A small Linux system can use 20 megabytes or less; a
larger system anywhere from 80 to 100 megabytes, or more. Keep in mind that
in addition to the space required by the software itself, you need to 
allocate extra space for user directories, room for future expansion, and
so forth. 

\index{partitions!size}
The size of your swap partition (should you elect to use one) depends on
how much virtual RAM you require. A rule of thumb is to use a swap partition 
that is twice the space of your physical RAM; for example, if you have 4
megabytes of physical RAM, an 8-megabyte swap partition should suffice.
Of course, this is mere speculation---the actual amount of swap space
that you require depends on the software which you will be running. If you 
have a great deal of physical RAM (say, sixteen megabytes or more), you 
may not wish to use swap space at all. 

{\bf Important note:} Because of BIOS limitations, it is usually not
possible to boot
from partitions using cylinders numbered over 1023. Therefore, when
setting aside space for Linux, keep in mind that you may not want to use
a partition in the $>$1023-cylinder range for your Linux root filesystem.
Linux can still {\em use\/} partitions with cylinders numbered over
1023, however, you may not be able to {\em boot\/} Linux from such a
partition. This advice may seem premature, but it is important to 
know while planning your drive layout. 

If you absolutely must use a partition with cylinders numbered over
1023 for your Linux root filesystem, you can always boot Linux from floppy.
This is not so bad, actually---it only takes a few seconds longer to boot
than from the hard drive. At any rate, it's always an option.
