18.104.22.168. Partition layout and types
There are two kinds of major partitions on a Linux system:
data partition: normal Linux system data, including the
root partition containing all the data to start up and run
the system; and
swap partition: expansion of the computer's physical
memory, extra memory on hard disk.
Most systems contain a root partition, one or more data
partitions and one or more swap partitions. Systems in mixed
environments may contain partitions for other system data, such as
a partition with a FAT or VFAT file system for MS Windows data.
Most Linux systems use fdisk at
installation time to set the partition type. As you may have
noticed during the exercise from Chapter 1, this usually happens
automatically. On some occasions, however, you may not be so lucky.
In such cases, you will need to select the partition type manually
and even manually do the actual partitioning. The standard Linux
partitions have number 82 for swap and 83 for data, which can be
journaled (ext3) or normal (ext2, on older systems). The fdisk utility has built-in help, should you forget
Apart from these two, Linux supports a variety of other file
system types, such as the relatively new Reiser file system, JFS,
NFS, FATxx and many other file systems natively available on other
(proprietary) operating systems.
The standard root partition (indicated with a single forward
slash, /) is about 100-500 MB, and contains the system
configuration files, most basic commands and server programs,
system libraries, some temporary space and the home directory of
the administrative user. A standard installation requires about 250
MB for the root partition.
Swap space (indicated with swap) is only accessible for
the system itself, and is hidden from view during normal operation.
Swap is the system that ensures, like on normal UNIX systems, that
you can keep on working, whatever happens. On Linux, you will
virtually never see irritating messages like Out of memory,
please close some applications first and try again, because of
this extra memory. The swap or virtual memory procedure has long
been adopted by operating systems outside the UNIX world by
Using memory on a hard disk is naturally slower than using the
real memory chips of a computer, but having this little extra is a
great comfort. We will learn more about swap when we discuss
Linux generally counts on having twice the amount of physical
memory in the form of swap space on the hard disk. When installing
a system, you have to know how you are going to do this. An example
on a system with 512 MB of RAM:
1st possibility: one swap partition of 1 GB
2nd possibility: two swap partitions of 512 MB
3rd possibility: with two hard disks: 1 partition of 512 MB on
The last option will give the best results when a lot of I/O is
to be expected.
Read the software documentation for specific guidelines. Some
applications, such as databases, might require more swap space.
Others, such as some handheld systems, might not have any swap at
all by lack of a hard disk. Swap space may also depend on your
The kernel is on a separate partition as well in many
distributions, because it is the most important file of your
system. If this is the case, you will find that you also have a
/boot partition, holding your kernel(s) and accompanying
The rest of the hard disk(s) is generally divided in data
partitions, although it may be that all of the non-system critical
data resides on one partition, for example when you perform a
standard workstation installation. When non-critical data is
separated on different partitions, it usually happens following a
a partition for user programs (/usr)
a partition containing the users' personal data
a partition to store temporary data like print- and mail-queues
a partition for third party and extra software
Once the partitions are made, you can only add more. Changing
sizes or properties of existing partitions is possible but not
The division of hard disks into partitions is determined by the
system administrator. On larger systems, he or she may even spread
one partition over several hard disks, using the appropriate
software. Most distributions allow for standard setups optimized
for workstations (average users) and for general server purposes,
but also accept customized partitions. During the installation
process you can define your own partition layout using either your
distribution specific tool, which is usually a straight forward
graphical interface, or fdisk, a text-based
tool for creating partitions and setting their properties.
A workstation or client installation is for use by mainly one
and the same person. The selected software for installation
reflects this and the stress is on common user packages, such as
nice desktop themes, development tools, client programs for E-mail,
multimedia software, web and other services. Everything is put
together on one large partition, swap space twice the amount of RAM
is added and your generic workstation is complete, providing the
largest amount of disk space possible for personal use, but with
the disadvantage of possible data integrity loss during problem
On a server, system data tends to be separate from user data.
Programs that offer services are kept in a different place than the
data handled by this service. Different partitions will be created
on such systems:
a partition with all data necessary to boot the machine
a partition with configuration data and server programs
one or more partitions containing the server data such as
database tables, user mails, an ftp archive etc.
a partition with user programs and applications
one or more partitions for the user specific files (home
one or more swap partitions (virtual memory)
Servers usually have more memory and thus more swap space.
Certain server processes, such as databases, may require more swap
space than usual; see the specific documentation for detailed
information. For better performance, swap is often divided into
different swap partitions.