Skip to content

Linux Disk Layout

Efficiently designing disk partitioning is essential for a successful installation.

Linux is a robust system that allows the file system to be divided into multiple partitions and multiple disks.

This scheme may be a bit confusing for users who are used to Microsoft Windows, but it is essential for the CompTIA Linux+ and LPI exams.

The choice of how the file system will be organized can be influenced by several factors such as the amount of disk space, system size, applications used, and how the backups will be performed.

Regardless of these variables, some important considerations need to be made and taken into account during the partitioning of the disks during installation.

The first point that needs to be addressed is the location of the boot loader on the disk. Most old BIOSes have the limitation of not being able to read disk sectors after cylinder 1024.

Thus, the GRUB boot loader must be located within the first 1024 cylinders in order to be able to load the Kernel correctly.

The new EFI and UEFI motherboard firmwares no longer have this limitation of being able to properly read only the first 1024 cylinders.

It is generally recommended that the boot loader be separated from the main file system and mounted as /boot if the root file system is formatted with a file system other than ext2, ext3, or ext4.

Some distributions do not support journaling for the boot partition, such as reiserfs and others.

On the other hand, on EFI motherboards, this firmware no longer uses the same Cylinder, Head and Sector (CHS) addressing scheme to detect disk geometry, preferring Logical Block Addressing (LBA).

Therefore, this 1024-cylinder limitation does not exist. On motherboards that use BIOS and that provide the LBA feature, this limit also does not need to be observed.

In both BIOS and EFI, it is It is highly recommended to separate the partition that will host the load system from kernel (GRUB or GRUB2), as well as the kernel image of the rest of the disk in a partition called “/boot” and format it with a simple file system like ext2fs or ext3fs. This allows cards that use EFI to be able to directly access this partition and GRUB.

The Swap Partition on Linux

Linux allows a special partition called Swap acts as a virtual disk memory allowing programs and data are stored temporarily, allowing the system to execute more programs concurrently.

The space allocated to this partition depends on the applications that will run on the system and the volume of data that these applications will handle.

As a rule, it is recommended that Swap be at least the same size as RAM and, on systems with low memory, three times its size.

If the disk space available for the Linux installation is small, say around 5GB, it is advisable to keep the root system in a single partition to avoid waste.

The following setting is recommended:

  • 150MB for the /boot partition;
  • 1 GB for the swap partition;
  • Remaining for the root system /.

For large systems where disk space is not as problematic, it is recommended that the root file system be divided into several Linux partitions and if possible on different disks as follows:

  • I suggest separating the /var directory into a partition large enough to accommodate the LOG files. The advantage is that if this partition becomes full it will not affect the stability of the system;
  • Separate the /tmp partition into a partition that accommodates all temporary files generated by applications and users;
  • Separate the /home partition offering users a partition large enough for their files;
  • Separate the swap partition between the disks if there is more than one. This may increase virtual memory performance.

In networks that have several machines with the same Linux version, the /usr folder can be installed on only one computer and shared between the various machines on a network as “read-only” via NFS.

The scheme used to partition a system’s disks will largely depend on the applications used, disk size and other factors already mentioned.

But it’s important to remember the need for the Kernel and the boot loader to be within the first 1024 cylinders (if your BIOS or EFI don’t support it), and to allocate at least the same size as the RAM for the swap partition.

Learn much more about Linux in our online course. You can enroll here with a free 7-day trial. If you already have an account, you can log in here.

Did you like it? Share :-)