Sub topic 4
Partitioning, Filesystems and Swap
This chapter assumes you know how to use a terminal, identify disks, and distinguish a physical disk from a filesystem. It also assumes you are installing Linux in a virtual machine, on physical hardware, or through a cloud provider that exposes storage settings.
Partitioning divides a disk into regions called partitions. A filesystem is the structure Linux uses to store files inside a partition. Swap is disk space that Linux can use as additional virtual memory when physical RAM is under pressure.
Choose a partition layout
For a simple server, let the installer use guided partitioning unless you have a specific storage requirement. Guided partitioning reduces mistakes with partition boundaries and boot settings.
A typical UEFI installation might use this layout:
| Partition | Typical size | Filesystem | Purpose |
|---|---|---|---|
| EFI System Partition | ಷ್ಟ256–512 MiB | FAT32 | Stores UEFI boot files |
| Root (`/`) | 20–50 GiB or more | ext4 or XFS | Operating system, services, and logs |
| Swap | Varies | Swap area | Memory pressure and hibernation support |
The EFI System Partition, often called the ESP, must be formatted as FAT32 and mounted at /boot/efi. A BIOS installation does not normally need an ESP. Mixing BIOS and UEFI assumptions can leave a correctly installed system unable to boot.
Use a separate /home partition only when you have a reason, such as protecting user data from a full root filesystem. On many servers, separate partitions for /var or /var/log can also prevent application data or logs from consuming all space. They add administration work, because a partition that is too small cannot easily borrow free space from another partition.
The root filesystem must have enough room for packages, logs, temporary files, and application data. XFS is common in RHEL-family environments. ext4 is a common general-purpose choice and is widely supported.
Decide how to use swap
Swap can absorb short memory spikes, but it is much slower than RAM. A swap partition has a fixed size. A swap file is easier to create or resize after installation and is often the better default for a virtual machine.
Do not treat swap as a replacement for sufficient RAM. For a server without hibernation, size swap according to workload and available memory rather than following an automatic rule.
# Inspect disks and mounted filesystems after installation
lsblk -f
findmnt
swapon --show
free -hThese commands are read-only. Check that the expected root filesystem is mounted, the ESP is present on a UEFI system, and swap is active if you configured it.
Exercise
Why might a server use a separate /var partition, and what risk does that choice introduce?
Show answer
It can keep logs and application data from filling the root filesystem. The risk is that /var may become full while unused space remains trapped in another partition.