fdisk
system managementLinux/Unix
The fdisk command is one of the most frequently used commands in Linux/Unix-like operating systems. fdisk Manipulate disk partition table
Quick Reference
Command Name:
fdisk
Category:
system management
Platform:
Linux/Unix
Basic Usage:
fdisk [options] [arguments]
Common Use Cases
Syntax
fdisk [options] [device]
Options
Option | Description |
---|---|
-b, --sector-size |
Specify the sector size of the disk |
-B, --protect-boot |
Don't erase the bootbits when creating a new label |
-c, --compatibility[= |
Set compatibility mode (dos or nondos) |
-L, --color[= |
Control color output (auto, always, or never) |
-l, --list |
List partition table for specified devices |
-x, --list-details |
Like --list but with more details |
-n, --noauto-pt |
Don't automatically create a default partition table on empty devices |
-o, --output |
Specify output columns for the table view |
-t, --type |
Specify the partition table type (dos, gpt, etc.) |
-u, --units[= |
Display units (cylinders, sectors, or specify custom) |
-s, --getsz |
Show the size of the device in sectors |
-w, --wipe |
Wipe signatures when writing a new table (auto, always, or never) |
-W, --wipe-partitions |
Wipe signatures from new partitions (auto, always, or never) |
-C, --cylinders |
Specify the number of cylinders |
-H, --heads |
Specify the number of heads |
-S, --sectors |
Specify the number of sectors per track |
Examples
How to Use These Examples
The examples below show common ways to use the fdisk
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
sudo fdisk -l