XK0-006 · System Management · Updated July 26, 2026
GPT Partitioning with gdisk, cgdisk, and sgdisk
The gptfdisk family — gdisk, cgdisk, and sgdisk — is a set of Linux partitioning tools built specifically for GUID Partition Table (GPT) disks. gdisk is the interactive, fdisk-style prompt tool; cgdisk is the curses-based, menu-driven version; and sgdisk is the fully scriptable command-line version, which can also back up and restore an entire partition table with a single option. On any modern drive larger than 2 TiB, GPT is not optional — the older Master Boot Record (MBR) scheme simply cannot address the space.
Why GPT replaced MBR
MBR, the partitioning scheme from the DOS era, stores the whole partition map in a single 512-byte sector at the start of the disk. That design imposes two hard ceilings: a maximum of four primary partitions (extended/logical partitions are a workaround, not a fix) and a 2 TiB addressable limit with 512-byte sectors, because partition sizes are stored as 32-bit sector counts.
GPT — part of the Unified Extensible Firmware Interface (UEFI) specification — fixes both. It uses 64-bit logical block addresses, supports 128 partitions by default without any extended-partition tricks, and identifies each partition and disk with a globally unique identifier (GUID). It also stores two copies of the partition table (a primary header at the start of the disk and a backup at the end), each protected by CRC32 checksums, so a corrupted primary table can be recovered from the backup. Finally, GPT disks carry a “protective MBR” in sector 0 so legacy tools see the disk as fully allocated instead of blank — which prevents an old utility from cheerfully overwriting your data.
So when a technician unboxes a 6 TB drive, MBR-era tooling is the wrong mental model from the first keystroke. The gptfdisk suite was written for exactly this situation.
The three tools, and when to reach for each
All three ship together (package name gdisk on Debian/Ubuntu, gdisk on RHEL-family too) and operate on the same on-disk structures — they differ only in interface.
gdisk is the text-prompt tool, deliberately modeled on classic fdisk: you run gdisk /dev/sdb, then use single-letter commands — p to print the table, n for a new partition, d to delete, t to change a partition’s type code, w to write and exit, q to quit without saving. It adds menus fdisk never had: r opens a recovery/transformation menu (rebuild a damaged header from the backup, convert MBR to GPT) and x opens an experts menu.
cgdisk is the menu-driven one. It presents a full-screen, curses-based interface — partitions listed in a scrollable pane, actions selected from a visible menu along the bottom — rather than a bare prompt where you must already know the command letters. If an exam scenario asks for an “interactive, menu-driven utility purpose-built for GPT,” with an interaction style clearly distinct from the classic MBR-oriented tool, that’s cgdisk. (Its visual ancestor is the old cfdisk, which historically targeted MBR.)
sgdisk is the script-friendly one: everything is expressed as command-line options, nothing is interactive, and it never asks for confirmation. That makes it ideal for kickstart/cloud-init provisioning — and dangerous enough that you should back up the table before using it by hand.
Backing up and restoring a GPT partition table
This is the single most exam-relevant sgdisk feature. Before risky changes, save the complete GPT data structures (both headers plus the partition entries) to a file:
sgdisk --backup=/root/sdb-table.bak /dev/sdb # long form
sgdisk -b /root/sdb-table.bak /dev/sdb # short form
If a later operation goes wrong, restore the saved table:
sgdisk --load-backup=/root/sdb-table.bak /dev/sdb # short form: -l
Note this backs up the partition table, not partition contents — restoring it recovers the layout so the filesystems inside become reachable again, but it is not a data backup. A few other sgdisk options worth recognizing: -n creates a partition (sgdisk -n 1:0:+500G /dev/sdb), -t sets a type code (-t 1:8300 for Linux filesystem, 8e00 for LVM, ef00 for the EFI System Partition), -p prints the table, and --zap-all (-Z) destroys both GPT and MBR structures to blank a disk — table structures only; actually making the data unrecoverable takes the methods in secure data destruction on Linux. After changing a table on a disk that’s in use, run partprobe /dev/sdb so the kernel re-reads it.
gdisk vs fdisk
| fdisk | gdisk | |
|---|---|---|
| Native partition scheme | MBR (modern versions handle GPT too) | GPT from the ground up |
| Heritage | Classic DOS-style MBR tool | Written for the UEFI/GPT era |
| Max disk size addressed | 2 TiB under MBR (512-byte sectors) | 8+ ZiB under GPT |
| Partition count | 4 primary (or 3 + extended/logicals) | 128 by default, no extended hack |
| Recovery features | None built in | r menu: rebuild from backup header, MBR→GPT conversion |
| Companion tools | cfdisk (menu), sfdisk (scripting) | cgdisk (menu), sgdisk (scripting) |
Modern util-linux fdisk can create GPT labels, but the XK0-006 objectives treat the gptfdisk suite as the purpose-built GPT toolset — and its recovery and backup capabilities genuinely have no fdisk equivalent.
Once the partition exists you still need a filesystem on it (mkfs.xfs, mkfs.ext4) and a persistent mount entry — see /etc/fstab mount options for that half of the workflow. And before trusting a brand-new or second-hand drive with data, it’s worth checking its health with smartctl — covered in SMART disk health monitoring.
How the XK0-006 exam tests this
- A scenario describes provisioning a large drive (well over 2 TiB) and asks which partitioning scheme or which tool family is required — the discrimination being MBR’s size ceiling versus GPT’s 64-bit addressing.
- A tool-identification question describes an interface style — “menu-driven, full-screen, built specifically for GPT” — and expects you to pick cgdisk over gdisk (prompt-driven) and sgdisk (non-interactive), or over cfdisk/fdisk (MBR heritage).
- A safety-procedure question: an admin is about to make destructive changes with sgdisk and wants a restorable copy of the current table first — the answer is the
--backup/-boption (restored later with--load-backup/-l). - A troubleshooting pattern: a GPT disk’s primary header is corrupted and the question asks how recovery is possible — because GPT keeps a checksummed backup table at the end of the disk, reachable from gdisk’s recovery menu.
Partitioning sits in the System Management domain — the full XK0-006 study guide covers how it fits alongside the rest of the storage objectives. Once the three tools feel distinct, practice questions for Linux+ will confirm it.
Quick reference
- GPT: 64-bit addressing, 128 partitions by default, primary + backup tables with CRC32 checksums, protective MBR in sector 0.
- MBR limits: 4 primary partitions, 2 TiB max with 512-byte sectors — disqualifying for any 6 TB drive.
gdisk= interactive prompt (fdisk-style letters: p, n, d, t, w);cgdisk= curses menu UI;sgdisk= non-interactive/scriptable.- Back up a partition table:
sgdisk -b <file> <disk>; restore:sgdisk -l <file> <disk>. Table only — not file data. - Common GPT type codes:
8300Linux filesystem,8e00LVM,ef00EFI System Partition,8200swap. sgdisk --zap-allwipes GPT and MBR structures;partprobemakes the kernel re-read a changed table.- gdisk’s
rmenu can rebuild a damaged primary table from GPT’s backup copy — fdisk has no equivalent.