fdisk [device]


Manipulate or display the partition table for device using a command-driven interactive text interface. device is a physical disk such as /dev/hda, not a partition such as /dev/hda1. If omitted, device defaults to /dev/hda. Interactive commands to fdisk are a single letter followed by a carriage return. The commands do not take arguments, but instead start an interactive dialog. Commands that operate on a partition will request the partition number, which is an integer. For primary and extended partitions, the partition number is from 1 to 4. For logical partitions, which are available only when the extended partition already exists to contain them, the partition number is from 5 to 16.

When making changes to the partition table, fdisk accumulates changes without writing them to the disk, until it receives the write command.

Frequently used commands


Toggle the bootable flag on/off for a primary partition.


Delete a partition. You are prompted for the partition number to delete. If you delete a logical partition when higher-numbered logical partitions exist, the partition numbers are decremented to keep logical partition numbers contiguous.


List the known partition types. A table of partition types is printed.


Display the brief help menu for these commands.


Add a new partition. You are prompted for the partition type (primary, extended, or logical). For primary and extended partitions, you are asked for the partition number (1–4). For logical ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.