Handbook:Parts/Blocks/DesigningPartitionScheme

== Designing a partition scheme ==

How many partitions and how big?
The design of disk partition layout is highly dependent on the demands of the system and the file system(s) applied to the device. If there are lots of users, then it is advised to have on a separate partition which will increase security and make backups and other types of maintenance easier. If Gentoo is being installed to perform as a mail server, then should be a separate partition as all mails are stored inside the  directory. Game servers may have a separate partition since most gaming server software is installed therein. The reason for these recommendations is similar to the directory: security, backups, and maintenance.

In most situations on Gentoo, and  should be kept relatively large in size. hosts the majority of applications available on the system and the Linux kernel sources (under ). By default, hosts the Gentoo ebuild repository (located at ) which, depending on the file system, generally consumes around 650 MiB of disk space. This space estimate excludes the and  directories, which will gradually fill with source files and (optionally) binary packages respectively as they are added to the system.

How many partitions and how big very much depends on considering the trade-offs and choosing the best option for the circumstance. Separate partitions or volumes have the following advantages:


 * Choose the best performing filesystem for each partition or volume.
 * The entire system cannot run out of free space if one defunct tool is continuously writing files to a partition or volume.
 * If necessary, file system checks are reduced in time, as multiple checks can be done in parallel (although this advantage is realized more with multiple disks than it is with multiple partitions).
 * Security can be enhanced by mounting some partitions or volumes read-only,  (setuid bits are ignored),   (executable bits are ignored), etc.

However, multiple partitions have certain disadvantages as well:


 * If not configured properly, the system might have lots of free space on one partition and little free space on another.
 * A separate partition for may require the administrator to boot with an initramfs to mount the partition before other boot scripts start. Since the generation and maintenance of an initramfs is beyond the scope of this handbook, we recommend that newcomers do not use a separate partition for .
 * There is also a 15-partition limit for SCSI and SATA unless the disk uses GPT labels.

What about swap space?
There is no perfect value for the swap partition. The purpose of swap space is to provide disk storage to the kernel when internal memory (RAM) is under pressure. A swap space allows for the kernel to move memory pages that are not likely to be accessed soon to disk (swap or page-out), freeing memory. Of course, if that memory is suddenly needed, these pages need to be put back in memory (page-in) which will take a while (as disks are very slow compared to internal memory).

When the system is not going to run memory intensive applications or the system has lots of memory available, then it probably does not need much swap space. However, swap space is also used to store the entire memory in case of hibernation. If the system is going to need hibernation, then a bigger swap space is necessary, often at least the amount of memory installed in the system.