Disk Partitioning in Linux: What It Is and How to Lay Out a Disk
What a partition is, MBR and GPT, which partitions a Linux system needs, sensible layouts for a desktop and a server, and the tools that create them.
3 min readBy Swati
Reviewed by the AmazingRDP technical team

Practise on a server you can reinstall in minutes. A Linux VPS gives you root access. See Linux VPS from $6.99
A disk is one long row of storage blocks. Partitioning divides that row into sections, and each section can hold its own filesystem, be mounted at its own place, or belong to a different operating system. Linux can live in a single partition, and often should. Knowing when to use more is what this page is about.
Why split a disk at all
- Containment. If logs fill a separate
/var, the rest of the system keeps working. - Reinstalling without losing data. With
/homeon its own partition, the system can be replaced around it. - Different rules per area: a data partition without permission to run programs, or encrypted while the system is not.
- Several systems on one disk, such as Windows beside Linux.
The price is rigidity: space left over in one partition cannot be used by another without resizing.
MBR or GPT
The partition table at the start of the disk records where the partitions are. Two formats exist.
| MBR (older) | GPT (current) | |
|---|---|---|
| Largest disk | 2 TB | Far beyond any disk you can buy |
| Partitions | Four primary; more only inside an "extended" one | 128 by default, no tricks |
| Safety copy | None | A second copy at the end of the disk |
| Starts with | Classic BIOS | UEFI (and BIOS, with a small extra partition) |
Use GPT for anything new. MBR remains on old machines and on some small virtual server images.
The partitions a Linux system uses
| Partition | Purpose | Typical size |
|---|---|---|
/ (root) | The system itself. The only one that is always required | 25 GB or more |
| EFI system partition | Start-up files on UEFI machines; mounted at /boot/efi | 500 MB to 1 GB |
| Swap | Overflow for memory; can also be a file inside / | 2 to 8 GB; equal to memory if the machine hibernates |
/home | Users' files | The rest, on a desktop |
/var | Logs, databases, mail, containers | By what the server does |
/boot | Kernels; needed separately with some encryption and LVM setups | 1 GB |
Sensible layouts
- Desktop or laptop: EFI, root and a swap file. Add a separate
/homeif you reinstall often. This is what installers choose by themselves. - Small server or VPS: one root partition. The disk is small, and a wrong split wastes more than it protects.
- Larger server: EFI,
/boot, and the rest handed to LVM, with logical volumes for root,/varand data. Volumes can be grown later while the system runs, which removes the main drawback of partitions: see setting up LVM. - Data disks: one partition across the whole disk, mounted where the data belongs.
How Linux names disks and partitions
| Name | Is |
|---|---|
/dev/sda, /dev/sdb | First and second SATA or SCSI disk |
/dev/sda1 | First partition on the first disk |
/dev/nvme0n1, /dev/nvme0n1p2 | First NVMe disk; its second partition |
/dev/vda | A virtual disk on many VPS platforms |
Look before you touch
lsblk -f
sudo fdisk -l
sudo parted -l
lsblk -f is the clearest: every disk and partition as a tree, with filesystem type and mount point. None of the three changes anything.
The tools that change things
| Tool | Style |
|---|---|
fdisk | Interactive, in the terminal; nothing is written until you type w |
parted | Terminal; changes apply at once; good in scripts |
cfdisk | Menus in the terminal |
| GParted, GNOME Disks | Graphical; can also resize and move |
These tools erase data without a second question if pointed at the wrong disk. Check the device name twice with lsblk, and have a backup.
From empty disk to usable space
Adding a second disk to a server takes four steps: create a partition table and a partition, make a filesystem on it, mount it, and make the mount permanent.
sudo parted /dev/sdb --script mklabel gpt mkpart primary ext4 0% 100%
sudo mkfs.ext4 /dev/sdb1
sudo mkdir /data
sudo mount /dev/sdb1 /data
The last step, the line in /etc/fstab, is explained in how to mount and automount drives. Check the result with findmnt.
Changing a layout later
- Growing the last partition into free space is routine:
growpart, thenresize2fsorxfs_growfs. This is what happens after a VPS is moved to a bigger plan. - Shrinking and moving are slow and risky; do them from a USB system with a full backup. XFS cannot be shrunk at all.
- Encryption is best decided at the start: see encrypting a disk with LUKS.
How full each partition is: monitoring disk space in Linux. For a server on which a mistake costs only a reinstall, see our Linux VPS plans.
Questions
What is disk partitioning?
Dividing a disk into sections that can each hold their own filesystem and be mounted or used separately.
Should I use MBR or GPT?
GPT for anything new. MBR is limited to 2 TB and four primary partitions.
Which partitions does Linux need?
Only a root partition, plus an EFI system partition on UEFI machines. Swap, /home and /var are optional.
How do I list partitions in Linux?
Run lsblk -f.