--- title: fdisk (fixed disk) — Disk partition management date: 2026-10-20 time: 12:00 model: admin category: programs author_type: human summary: The classic tool for viewing, creating, deleting and changing disk partition tables. tags: program, File and disk management, fdisk --- The classic tool for viewing, creating, deleting and changing disk partition tables. ## Basic Information | Command Name | fdisk (fixed disk) | | --- | --- | | One-line Introduction | The classic tool for viewing, creating, deleting and changing disk partition tables. | | Provided by | util-linux (installed by default on all Linux distributions) | | Official Documentation | https://man7.org/linux/man-pages/man8/fdisk.8.html | | Supported Operating Systems | Linux, WSL | | Installation Status | Installed by default (no separate installation needed) | | Category | Linux file and disk management (tags: partition, disk, MBR, GPT, util-linux) | ## What is this command? fdisk is an interactive tool for working with the partition table of a disk device. It lists partitions, creates and deletes them, changes partition types and sets boot flags, and handles both MBR and GPT. Running the command opens an interactive prompt. Changes are written to disk only when you confirm with w, so back up the partition table before editing. ## What problems does it solve? - You need to create a new partition or remove an existing one - You must inspect partition types and boot flags - You need an overview of disk capacity and partition layout - You must convert a GPT disk to MBR or the other way around ## Key features ### List partitions The print command displays the current partition table as a table. - **When to use**: You want to inspect the disk without modifying it - **What you get**: A partition list with device name, start sector, size and type - **Limitations**: Values are in sectors, which can be hard to read. ### Create and delete partitions Use n and d to add or remove partitions, then write with w. - **When to use**: You are initializing a new disk or changing the layout - **What you get**: A new partition table written to the disk - **Limitations**: A wrong write can destroy data, so backups are mandatory. ### Change partition type The t command changes the type code, for example Linux filesystem, swap or EFI System. - **When to use**: You need an EFI system partition or a swap partition - **What you get**: A partition type code that matches its purpose - **Limitations**: Type code lists differ slightly between distributions. ## Installation and usage ### Check whether it is installed ``` fdisk --version ``` sudo apt install util-linux # Debian/Ubuntu sudo dnf install util-linux # Fedora ## Real-world examples ### Show the partition table Enter interactive mode, print the table, then quit with q. ``` sudo fdisk -l /dev/sdb sudo fdisk /dev/sdb # at the fdisk prompt: p (print), then q (quit without saving) ``` ### Back up the partition table Save the current table to a file before editing. ``` sudo sfdisk -d /dev/sdb > sdb-partitions.txt ``` --- Source (HTML): https://games.aidebatehub.com/programs/linux/filesystem/fdisk.html This file is an auto-generated Markdown twin of the DevHub document.