From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

fdisk is a dialog-driven command-line utility commonly found on Linux systems that is used for disk partitioning. It is one of the most commonly used tools for creating and managing disk partitions.

fdisk is a powerful tool and should be treated with respect. Only root (or users who have elevated their privileges) can manipulate partition tables.


The fdisk utility allows users to create and manipulate partition tables on a hard disk. It supports GPT, MBR, Sun, SGI, and BSD partition tables. Users can create, resize, modify, delete, and move disk partitions.



The fdisk utility should already be available on any Gentoo systems, since it is a part of util-linux package, which is in @system. In case it's not, emerge the package with:

root #emerge --ask sys-apps/util-linux


To list the partition table of a device, the fdisk command is invoked with the -l option, followed by the device name. For example, to list the /dev/nvme0n1 partition table and partitions, the command would be fdisk -l /dev/nvme0n1.

root #fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 980 PRO 1TB                 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4BABCAFE-B0BA-DEAD-BEEF-A0B105F00D0A

Device           Start        End    Sectors   Size Type
/dev/nvme0n1p1    2048    8390655    8388608     4G EFI System
/dev/nvme0n1p2 8390656 1953523711 1945133056 927.5G Linux filesystem

To start partitioning a drive, fdisk is run with the device name. For example, to work on /dev/nvme0n1, the command would be fdisk /dev/nvme0n1.

Changes made to the partition table won’t take effect until they are written with the w command.