LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

fdisk

partition table manipulator

TLDR

List partitions
$ sudo fdisk -l
copy
Start the interactive partition manipulator
$ sudo fdisk [/dev/sdX]
copy

SYNOPSIS

fdisk [-l] [-u] [-s partition] [device]

DESCRIPTION

fdisk is a dialog-driven program for managing partition tables and partitions on storage drives. It supports MBR, GPT, SGI, and Sun partition tables.

PARAMETERS

-l, --list

List partition tables for all devices or specified device
-u, --units
Display units in sectors (default) or cylinders
-s, --getsz partition
Print size of partition in 512-byte sectors
-b, --sector-size size
Specify physical and logical sector size
-c, --compatibility mode
Specify compatibility mode (dos or nondos)
-L, --color
Colorize output
-t, --type type
Specify disk label type (dos, gpt, sgi, sun)

INTERACTIVE COMMANDS

m: Display help menup: Print partition tablen: Create new partitiond: Delete partitiont: Change partition typel: List known partition typesw: Write changes and exitq: Quit without saving changesg: Create new GPT partition tableo: Create new DOS partition table

CAVEATS

Dangerous: Changes are written when you press 'w'. Double-check before writing. Modern fdisk supports GPT natively. MBR partition tables (not fdisk) are limited to 2TB; use GPT for larger disks.

HISTORY

Part of util-linux package. Based on the original fdisk from Minix and early Linux. One of the oldest Linux disk partitioning tools.

SEE ALSO

parted(8), cfdisk(8), gdisk(8), sfdisk(8), partprobe(8)

Copied to clipboard
Kai