O'Reilly logo

LPI Linux Certification in a Nutshell, 3rd Edition by James Stanger, Bruno Gomes Pessanha, Stephen Addison Schneiter, Adam Haeder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

fdisk

Syntax

fdisk [device]

Description

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

a

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

d

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.

l

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

m

Display the brief help menu for these commands.

n

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required