Partitioning your disk simply refers to the act of breaking up your disk into sections. Each section is then independent of the others. It's roughly equivalent to putting up walls in a house; if you add furniture to one room it doesn't affect any other room.
If you already have an operating system on your system (Windows95, Windows NT, OS/2, MacOS, Solaris, FreeBSD, …) and want to stick Linux on the same disk, you will probably need to repartition the disk. In general, changing a partition with a filesystem already on it will destroy any information there. Thus you should always make backups before doing any repartitioning. Using the analogy of the house, you would probably want to move all the furniture out of the way before moving a wall or you risk destroying it.
At a bare minimum, GNU/Linux needs one partition for itself. You can have a single partition containing the entire operating system, applications, and your personal files. Most people feel that the swap partition is also a necessity, although it's not strictly true. ``Swap'' is scratch space for an operating system, which allows the system to use cheap disk storage as ``virtual memory''. By putting swap on a separate partition, Linux can make much more efficient use of it. It is possible to force Linux to use a regular file as swap, but it is not recommended.
Most people choose to give GNU/Linux more than the minimum number of partitions, however. There are two reasons you might want to break up the filesystem into a number of smaller partitions. The first is for safety. If something happens to corrupt the file system, generally only one partition is affected. Thus, you only have to replace (from the backups you've been carefully keeping) a portion of your system. At a bare minimum, you should consider creating what is commonly called a ``root partition''. This contains the most essential components of the system. If any other partitions get corrupted, you can still boot into GNU/Linux to fix the system. This can save you the trouble of having to reinstall the system from scratch.
The second reason is generally more important in a business setting, but it
really depends on your use of the machine. Suppose something runs out of
control and starts eating disk space. If the process causing the problem
happens to have root privileges (the system keeps a percentage of the disk away
from users), you could suddenly find yourself out of disk space. This is not
good as the OS needs to use real files (besides swap space) for many things.
It may not even be a problem of local origin. For example, getting spammed
with e-mail can easily fill a partition. By using more partitions, you protect
the system from many of these problems. Using mail as an example again, by
putting /var/spool/mail
on its own partition, the bulk of the
system will work even if you get spammed.
The only real drawback to using more partitions is that it is often difficult to know in advance what your needs will be. If you make a partition too small then you will either have to reinstall the system or you will be constantly moving things around to make room in the undersized partition. On the other hand, if you make the partition too big, you will be wasting space that could be used elsewhere. Disk space is cheap nowadays, but why throw your money away?
The following list describes some important directories. It should help you to find out what your partitioning scheme should be. If this is too confusing for you, just ignore it and reread it when you read the rest of the installation manual.
/
: root represents the starting point of the directory hierarchy.
It contains the essential programs that the computer can boot. This includes
the kernel, system libraries, configuration files in /etc
and
various other needed files. Typically 30-50 MB are needed but this may vary.
Note: do not partition /etc
, /bin
,
/sbin
, /lib
or /dev
as its own
partition; you won't be able to boot.
/dev
: this directory contains the various device files which are
interfaces to the various hardware components. For more information see Device Names in Linux, Section
4.3.
/usr
: all user programs (/usr/bin
), libraries
(/usr/lib
), documentation (/usr/share/doc
), etc., are
in this directory. This part of the filesystem needs most of the space. You
should at least provide 300-500 MB of disk space. If you want to install more
packages you should increase the amount of space you give this directory.
/home
: every user will put his data into a subdirectory of this
directory. The size of this depends on how many users will be using the system
and what files are to be stored in their directories. Depending on your
planned usage you should reserve about 100 MB for each user, but adapt this
value to your needs.
/var
: all variable data like news articles, e-mails, websites,
APT's cache, etc. will be placed under this directory. The size of this
directory depends greatly on the usage of your computer, but for most people
will be dictated by the package management tool's overhead. If you are going
to do a full installation of just about everything Debian has to offer, all in
one session, setting aside 2 or 3 gigabytes of space for /var
should be sufficient. If you are going to install in pieces (that is to say,
install services and utilities, followed by text stuff, then X, ...), you can
get away with 2-5 hundred megabytes of room in /var
. If harddrive
space is at a premium and you don't plan on using APT, at least not for major
updates, you can get by with as little as 30 or 40 megabytes in
/var
.
/tmp
: if a program creates temporary data it will most likely go
in there. 20-50 MB should be usually enough.
/proc
: this is a virtual file system which doesn't reside on the
harddisk. Thus no harddisk space is needed. It provides interesting and also
vital information about the running system.
It is important to decide what type of machine you are creating. This will determine disk space requirements and affect your partitioning scheme.
This has changed for Potato -- we need to update it. There are a number of common task applications What does this need to be called? which Debian offers for your convenience (see Select and Install Profiles, Section 7.21). Common task applications are simply sets of package selections which make it easier for you, in that a number of packages are automatically marked for installation.
Each given common task application has a size of the resulting system after installation is complete. Even if you don't use these common task applications, this discussion is important for planning, since it will give you a sense of how large your partition or partitions need to be.
The following are some of the available common task applications and their sizes: The various applications and sizes should probably go here.
Remember that these sizes don't include all the other materials which are
usually to be found, such as user files, mail, and data. It is always best to
be generous when considering the space for your own files and data. Notably,
the Debian /var
partition contains a lot of state information.
The dpkg
files (with information on all installed packages) can
easily consume 20MB; with logs and the rest, you should usually allocate at
least 50MB for /var
.
Linux disks and partition names may be different from other operating systems. You need to know the names that Linux uses when you create and mount partitions. Here's the basic naming scheme:
The partitions on each disk are represented by appending a decimal number to the disk name: ``sda1'' and ``sda2'' represent the first and second partitions of the first SCSI disk drive in your system.
Here is a real-life example. Let's assume you have a system with 2 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 3 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 yourself the drive models.
VMEbus systems using the TEAC FC-1 SCSI floppy drive will see it as normal SCSI disk. To make identification of the drive simpler the installation software will create a symbolic link to the appropriate device and name it ``/dev/sfd0''.
As described above, you should definitely have a separate smaller root
partition, and a larger /usr
partition, if you have the space.
For examples, see below. For most users, the two partitions initially
mentioned are sufficient. This is especially appropriate when you have a
single small disk, since breaking out lots of partitions can waste space.
In some cases, you might need a separate /usr/local
partition if
you plan to install many programs that are not part of the Debian distribution.
If your machine will be a mail server, you might need to make
/var/spool/mail
a separate partition. Often, putting
/tmp
on its own partition, for instance 20 to 32MB, is a good
idea. If you are setting up a server with lots of user accounts, it's
generally good to have a separate, large /home
partition. In
general, the partitioning situation varies from computer to computer depending
on its uses.
For very complex systems, you should see the Multi Disk
HOWTO
. This contains in-depth information, mostly of interest to
ISPs and people setting up servers.
With respect to the issue of swap partition size, there are many views. One rule of thumb which works well is to use as much swap as you have system memory, although there probably isn't much point in going over 64MB of swap for most users. It also shouldn't be smaller than 16MB, in most cases. Of course, there are exceptions to these rules. If you are trying to solve 10000 simultaneous equations on a machine with 256MB of memory, you may need a gigabyte (or more) of swap. On the other hand, Atari Falcons and Macs feel pain when swapping, so instead of making a large swap partition, get as much RAM as possible.
On 32-bit architectures (i386, m68k, 32-bit SPARC, and PowerPC), the maximum size of a swap partition is 2GB (on Alpha and SPARC64, it's so large as to be virtually unlimited). This should be enough for nearly any installation. However, if your swap requirements are this high, you should probably try to spread the swap across different disks (also called ``spindles'') and, if possible, different SCSI or IDE channels. The kernel will balance swap usage between multiple swap partitions, giving better performance.
As an example, one of the authors' home machine has 32MB of RAM and a 1.7GB IDE
drive on /dev/hda
. There is a 500MB partition for another
operating system on /dev/hda1
(should have made it 200MB as it
never gets used). A 32MB swap partition is used on /dev/hda3
and
the rest (about 1.2GB on /dev/hda2
) is the Linux partition.
There are two different times that you can partition: prior to the installation of Debian, or during installation of Debian. If your computer will be solely dedicated to Debian, you should partition as part of the installation process (``Partition a Hard Disk'', Section 7.7). If you have a machine with more than one operating system on it, you generally should let the native operating system create its own partitions.
The following sections contain information regarding partitioning in your native operating system prior to installation. Note that you'll have to map between how the other operating system names partitions, and how Linux names partitions; see Device Names in Linux, Section 4.3.
If you are running AmigaOS, you can use the HDToolBox
program to
partition your disk prior to installation. Here's how:
HDToolBox
, select the disk you want to use, click on the
``Partition Drive'' button and select or create the partition you want to use
as the Debian root filesystem.
HDToolBox
you have
installed)
HDToolBox
and select ``Save changes
to drive''. Think twice before actually clicking on ``Yes'' -- have you chosen
the correct partitions? No important data could get lost now if you made a
mistake? Then click ``OK''. If required, the Amiga will reboot after this.
Atari partition IDs are three ASCII characters, use ``LNX'' for data and ``SWP'' for swap partitions. If using the low memory installation method, a small Minix partition is also needed (about 2 MB), for which the partition ID is ``MNX''. Failure to set the appropriate partition IDs not only prevents the Debian installation process from recognizing the partitions, but also results in TOS attempting to use the Linux partitions, which confuses the harddisk driver and renders the whole disk inaccessible.
There are a multitude of third party partitioning tools available (the Atari
harddisk
utility doesn't permit changing the partition ID); this
manual cannot give detailed descriptions for all of them. The following
description covers SCSITool
(from Hard+Soft GmBH).
SCSITool
and select the disk you want to partition (``Disk''
menu, item ``select'').
For the ``Change'' option, select the partition to change in the selection list, and select ``other systems'' in the dialog box. The next window lists detailed information about the location of this partition, and lets you change the partition ID. Save changes by leaving the window with the ``Ok'' button.
SCSITool
using the ``Quit'' item from the ``File'' menu. The
computer will reboot to make sure the changed partition table is used by TOS.
If you changed any TOS/GEM partitions, they will be invalidated and have to be
reinitialized (we told you to back up everything on the disk, didn't we?).
There is a partitioning tool for Linux/m68k called atari-fdisk
in
the installation system, but for now we recommend you partition your disk using
a TOS partition editor or some disk tool. If your partition editor doesn't
have an option to edit the partition type, you can do this crucial step at a
later stage (from the booted temporary install ramdisk). SCSITool
is only one of the partition editors we know of which supports selection of
arbitrary partition types. There may be others; select the tool that suits
your needs.
Partitioning tools for Macintosh tested include HD SC Setup
7.3.5
(Apple), HDT
1.8 (FWB), SilverLining
(LaCie), and
DiskTool
(Tim Endres, GPL). Full versions are required for
HDT
and SilverLining
. The Apple tool requires a
patch in order to recognize third-party disks (a description on how to patch
HD SC Setup
using ResEdit
can be found at http://www.euronet.nl/users/ernstoud/patch.html
).
was the following paragraph removed on purpose? I found it in the
"Installing Debian GNU/Linux 2.1 For Motorola 680x0 - Partitioning your
Hard Drive." For IDE based Macs, you need to use Apple Drive
Setup
to create empty space for the Linux partitions, and complete the
partitioning under Linux, or use the 68k MacOS version of pdisk available from
the MkLinux FTP server.
The following recipe is for partition with Apple's HD SC Setup
.
Whatever tool you use, the partition type has to be set to ``Apple_Unix_SVR2''.
The partition names need to be ``A/UX Root'', ``A/UX Root&Usr'' or ``A/UX
Usr'' for data partitions; and ``swap'' for swap partitions. The swap
partition must be named ``swap'' or else it won't be recognized by the
installer. HD SC Setup
will use the right names and type when
creating A/UX partitions in a ``Custom'' partition scheme. Partitions are
selected for deletion, creation or resizing using the mouse, the partition name
and type can be selected from a list of predefined types.
DiskTool
can create A/UX type partitions but requires that the
user type in the partition names manually.
The following recipe is for partition with pdisk 68k
and
Apple Drive Setup
.
To begin, launch Apple Drive Setup
, choose the drive you will use,
and click `initialize'. Next, choose `custom' and set up the partitions
according to your needs. Click `ok', and go ahead with the initialization
process. After the steps involving Apple Drive Setup
are
complete, quit the program and launch pdisk 68k
. In pdisk
68k
choose `e' and enter which hard drive to use (usually that will be
/dev/hda). Next choose `p' and note the starting base and length of the
partitions. After this choose `d'. Enter the partition number of the first
intended Linux partition. Next, choose `c' and enter the starting base and
length of the partition. Give it a semi-descriptive name (e.g. root, usr,
home, etc). Repeat for every Linux partition. For the swap partition it is
vital for the name to be ``swap'' or else the installer will not recognize it
as swap.
Descriptions for other tools are welcome. FIXME: more can be gleaned from the Debian/Mac install guide