Skip to main content
RunBook Academy

LinuxXIII · Disks and Block DevicesPartitioning

Partitions, GPT, and MBR

Foundation⏱ ~10 minbashfdiskgdiskpartedlsblk

What you'll learn

  • Distinguish MBR and GPT partition tables
  • Use fdisk, gdisk, and parted to inspect and create partitions
  • Recognize the partition layout of a typical Linux host
  • Plan a partition scheme for a new disk

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

The partition table is the first structure on a disk. It tells the firmware and the kernel where each partition starts and ends. A Linux host cannot boot without a valid partition table on the boot disk.

MBR vs GPT

Two partition table formats are in production today. They are not compatible.

MBRGPT
Max disk size2 TiB8 ZiB
Max partitions4 primary (or 3 + extended)128
Backup headerNoYes (end of disk)
CRCNoYes
Modern hostNo (legacy)Yes (default)
Read-only / Safefdisk -l
$ fdisk -l /dev/sda
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Disklabel type: gpt
Device       Start      End  Sectors  Size Type
/dev/sda1     2048   2099199  2097152    1G EFI System
/dev/sda2  2099200 209715166 207615967 99G Linux filesystem

Inspecting partitions

Read-only / Safegdisk -l
$ gdisk -l /dev/sda
GPT fdisk (gdisk) version 1.0.9
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 209715200 sectors, 100.0 GiB
Number  Start (sector)  End (sector)  Size     Code  Name
1            2048        2099199   1024.0 MiB  EF00  EFI System
2         2099200      209715166  99.0 GiB    8300  Linux filesystem

Creating a partition scheme

For a new disk, the standard production layout is:

  1. Create a GPT partition table with parted or gdisk
  2. Create partition 1 as the EFI System Partition (at least 512 MB, FAT32)
  3. Create partition 2 as a Linux filesystem (ext4 or xfs, rest of the disk)
  4. Or create partition 2 as an LVM physical volume for flexible storage
  5. Write the partition table and verify with fdisk -l
  6. Create the filesystem with mkfs.ext4 or mkfs.xfs
  7. Mount with a UUID in /etc/fstab; verify with mount -a

Partition types and codes

Read-only / Safepartition type codes
$ gdisk -l /dev/sda 2>/dev/null | grep -E '^\\s+[0-9]+'
1 2048 2099199 1024.0 MiB EF00 EFI System
2 2099200 209715166 99.0 GiB 8300 Linux filesystem

Knowledge check

Knowledge check · 3 questions

  1. Q1. What is the maximum disk size for MBR partition tables?

  2. Q2. GPT stores a backup header at the end of the disk for recovery if the primary header is corrupted.

  3. Q3. Which of the following are correct for a production Linux host with a single boot disk? Select all that apply.

Passing score: 75%. Answers are checked in this browser.