Back to the command reference

fdisk

DisksAdvanced In real Linux

View and edit disk partition tables

Name: fdisk = fixed disk (partitioning tool)

This command needs a real Linux system; you can practise it in real Linux mode.

Full man page

Description

fdisk is an interactive partitioning tool to view, create and delete partitions and change their types, on MBR and GPT disks. Nothing changes until you press w, but once written data can be lost, so double-check the disk.

Syntax

fdisk [OPTION]... DEVICE

Common options

-l / --listList partition tables
pInteractive: print the partition table
n / d / w(interactive) new / delete partition / write changes
tInteractive: change a partition’s type (to Linux swap, say)
g / oInteractive: a new empty GPT / MBR partition table
qInteractive: quit without saving

Examples

  • $ sudo fdisk -l

    Partitions of every disk

    Explain
  • $ sudo fdisk /dev/sda

    Partition the practice disk (interactive; m for help)

    Explain

Related