Abstract
Basically, a disk is physically divided into sectors. A sequence of sectors can form a partition. Roughly speaking, you can create as many partitions as you wish; each of them is regarded as a single hard drive.
To simplify, a hard disk is merely a sequence of sectors, which are the smallest data unit on a hard disk. The typical size of a sector is 512 bytes. The sectors on a hard disk of ( n ) sectors are numbered from ( 0 ) to ( n-1 ).
The use of multiple partitions enables you to create many virtual hard drives on your real physical drive. This has many advantages:
Different operating systems use different disk structures (called file systems): this is the case for Windows and GNU/Linux. Having multiple partitions on a hard drives allows you to install various operating systems on the same physical drive.
For performance reasons, a single operating system may prefer different drives with various file-systems on them because they are used for completely different things. One example is GNU/Linux which requires a second partition called “swap”. This partition is used by the virtual memory manager as virtual memory.
Even if all of your partitions use the same file-system, it may prove useful to separate the different parts of your OS. In the simplest configuration, you can split your files into two partitions, one for your personal data, and another for programs. This allows you to update your OS, completely erasing the partition containing the programs while keeping the data partition safe.
Physical errors on a hard disk are generally located on adjacent sectors and not scattered across the disk. Distributing your files onto different partitions will limit data loss in case of hard disk physical damage.
Normally, the partition type specifies the file-system that the partition is supposed to contain. Each operating system recognizes some of the partition types, but not others. See the chapter about GNU/Linux file-systems in the Reference Manual for more information.
The simplest configuration will have only two partitions: one for the swap space, the other for the files [1].
Separate data from programs. To be even more efficient, one usually defines a third partition called the “root” and labeled as /. It will contain the programs required to startup your system and perform basic maintenance.
So we could define four partitions:
A partition of type swap, whose size is roughly twice the amount of physical RAM.
The most important partition. Not only does it contain critical data and programs for the system, but will also act as a mount point for other partitions.
The needs of the root partition in terms of size are very limited, 300MB is generally enough. However, if you plan to install commercial applications, which are most often located in /opt, you will need to increase the size of the root partition. Alternatively, you may create a separate partition for /opt.
Most packages install the majority of their executables and data files under /usr. The advantage to creating a separate partition is that it allows you to easily share it with other machines over a network.
The recommended size depends on the packages you wish to install, and can vary from 100MB for a lightweight installation to several GB for a full install. A compromise of one or two GB (depending on your disk size) is usually sufficient.
This directory contains the personal directories for all the users hosted on the machine. It also generally hosts the directories served by HTTP for web browsers and FTP for file transfers.
The partition size depends on the number of users (or services) hosted and their needs.
A variation on this solution is not to create a separate partition for the /usr files: /usr will simply be a directory inside the root / partition.
When setting up your machine for specific uses such as a web server or a firewall, the needs are radically different than for a standard desktop machine. For example, a FTP server will probably need a large separate partition for /var/ftp, while the /usr will be relatively small. In these situations, you are encouraged to carefully think about your needs before even beginning the install process.
If you've been using your system for a while and realize that you should have chosen different sizes and partition scheme, it is possible to resize most partitions without the need to reinstall your system and without the loss of your data. Consult Managing Your Partitions of the Starter Guide .
With a little bit of practice, you will even be able to move a crowded partition to a brand new hard drive.