Advanced Package: util-linux

fdisk

View and edit disk partition tables (MBR).

Syntax

fdisk device

Description

fdisk is an interactive partition editor for creating, deleting and resizing partitions on MBR (and to an extent GPT) disks. Changes are only written to disk when explicitly saved, which gives some safety margin while learning.

Examples

sudo fdisk -l
List all disks and their partition tables (safe, read-only)
sudo fdisk /dev/sdb
Open an interactive session to edit a disk's partitions
fdisk -l /dev/sdb
List partitions on a single specific disk
For GPT disks over 2TB, gdisk/parted are generally preferred.

Applies to

Ubuntu Debian Linux Mint RHEL CentOS / Rocky / AlmaLinux Fedora Arch Linux openSUSE Alpine Linux