FDISK(8)
๐พ FDISK(8) โ the manual page, but make it make sense ๐
okay bestie, sit down, hydrate, because we're about to talk about fdisk โ yes, that one. the disk partition table one. it lives in section 8 (System Administration) and it's genuinely iconic, no cap. ๐
โจ NAME โจ
fdisk โ manipulate disk partition table ๐ฆ
๐ธ SYNOPSIS ๐ธ
fdisk [options] device
fdisk -l [device...]
๐ DESCRIPTION ๐
So like. fdisk is a dialog-driven program for creating and manipulating partition tables. It's the "let's have a little chat about your disk" girlie. And the way it understands GPT, MBR, Sun, SGI and BSD partition tables? Versatile. Multi-talented. Main character energy. ๐
Here's the lore: block devices can be split up into one or more logical disks called partitions. That whole division gets written down in the partition table, which is usually chilling in sector 0 of the disk. (And if you're in the BSD world, people say disk slices and disklabel instead โ different vocabulary, same vibe.)
All partitioning is driven by device I/O limits (the topology) by default. fdisk is able to optimize the disk layout for a 4K-sector size and use an alignment offset on modern devices for MBR and GPT. And fr fr โ it is always a good idea to follow fdisk's defaults, because the default values (like first and last partition sectors) and the partition sizes you specify with the +/-<size>{M,G,...} notation are always aligned according to the device properties. The defaults are not boring, they are correct. Respect them. ๐ซถ
โ ๏ธ CHS (Cylinder-Head-Sector) addressing is deprecated and not used by default. Please, do not follow old articles and recommendations with fdisk -S <n> -H <n> advice for SSD or 4K-sector devices. That advice is expired. Throw it away. It's giving 2009. ๐
Also, quick heads up: partx(8) provides a rich interface for scripts to print disk layouts, whereas fdisk is mostly designed for humans. Backward compatibility in the output of fdisk is not guaranteed. The input (the commands) should always be backward compatible. So script against partx(8), talk to fdisk yourself. iykyk. ๐
๐ OPTIONS ๐
-b,--sector-sizesectorsize โ specify the sector size of the disk. Valid values are512,1024,2048, and4096. The kernel is aware of the sector size for regular block devices. Use this option only on very old kernels, when working with disk images, or to override the kernel's default sector size. Sinceutil-linux-2.17,fdiskdistinguishes between logical and physical sector size. This option changes both sector sizes to the specified sectorsize.-B,--protect-bootโ don't erase the beginning of the first disk sector when creating a new disk label. This feature is supported for GPT and MBR. Protect the boot, bestie. ๐ก๏ธ-c,--compatibility[=mode]โ specify the compatibility mode:'dos'or'nondos'. The default is non-DOS mode. For backward compatibility, it is possible to use the option without the mode argument โ then the default is used. Note that the optional mode argument cannot be separated from the-coption by a space; the correct form is-c=dos, for example. (Space is not the moment here. ๐ซ)-L,--color[=when]โ colorize the output. The optional argument when can beauto,neveroralways. If the when argument is omitted, it defaults toauto. The colors can be disabled; for the current built-in default see the--helpoutput. See also the COLORS section. โจ-l,--listโ list the partition tables for the specified devices and then exit.- If no devices are given, the devices mentioned in
/proc/partitions(if this file exists) are used. Devices are always listed in the order in which they are specified on the command-line, or by the kernel listed in/proc/partitions.
- If no devices are given, the devices mentioned in
-x,--list-detailsโ like--list, but provides more details. Extra. In the best way. ๐ฅ--lock[=mode]โ use an exclusive BSD lock for the device or file that is operated upon. The optional argument mode can beyes(1),no(0), ornonblock. If the mode argument is omitted, it defaults toyes. This option overrides the environment variable$LOCK_BLOCK_DEVICE. The default is to not use any lock at all, but using a lock is recommended to avoid collisions withsystemd-udevd(8)or other tools.-n,--noauto-ptโ don't automatically create a default partition table on an empty device. The partition table has to be explicitly created by user (by command like'o','g', etc.). You want it? You build it. ๐ช-o,--outputlist โ specify which output columns to print. Use--helpto get a list of all supported columns.- The default list of columns may be extended if list is specified in the format
+list(e.g.,-o +UUID).
- The default list of columns may be extended if list is specified in the format
--bytes*โ print SIZE in bytes rather than in human readable format.-s,--getszโ print the size in 512-byte sectors of each given block device. This option is DEPRECATED in favour ofblockdev(8). Old. Retired. We don't do that anymore. ๐ชฆ-t,--typetype โ enable support only for disklabels of the specified type, and disable support for all other types. One type only. Exclusive. ๐ฏ-u,--units[=unit]โ when listing partition tables, show sizes in'sectors'or in'cylinders'. The default is to show sizes in sectors. For backward compatibility, it is possible to use the option without the unit argument โ then the default is used. Note that the optional unit argument cannot be separated from the-uoption by a space; the correct form is-u=cylinders, for example.-C,--cylindersnumber โ specify the number of cylinders of the disk. I have no idea why anybody would want to do so. ๐ญ (that's not me being shady, that's literally what the page says, and honestly? fair.)-H,--headsnumber โ specify the number of heads of the disk. (Not the physical number, of course, but the number used for partition tables.) Reasonable values are255and16.-S,--sectorsnumber โ specify the number of sectors per track of the disk. (Not the physical number, of course, but the number used for partition tables.) A reasonable value is63.-w,--wipewhen โ wipe filesystem, RAID and partition-table signatures from the device, in order to avoid possible collisions. The argument when can beauto,neveroralways. When this option is not given, the default isauto, in which case signatures are wiped only when in interactive mode. In all cases detected signatures are reported by warning messages before a new partition table is created. See alsowipefs(8)command. ๐งน-W,--wipe-partitionswhen โ wipe filesystem, RAID and partition-table signatures from a newly created partitions, in order to avoid possible collisions. The argument when can beauto,neveroralways. When this option is not given, the default isauto, in which case signatures are wiped only when in interactive mode and after confirmation by user. In all cases detected signatures are reported by warning messages before a new partition is created. See alsowipefs(8)command.-h,--helpโ display help text and exit.-V,--versionโ display version and exit.
๐ฆ DEVICES ๐ฆ
The device is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk.
Old systems without libata (a library used inside the Linux kernel to support ATA host controllers and devices) make a difference between IDE and SCSI disks. In such cases the device name will be /dev/hd* (IDE) or /dev/sd* (SCSI). Vintage behavior, still valid. ๐ฐ๏ธ
The partition is a device name followed by a partition number. For example, /dev/sda1 is the first partition on the first hard disk in the system. See also Linux kernel documentation (the Documentation/admin-guide/devices.txt file). ๐
๐ SIZES ๐
The "last sector" dialog accepts partition size specified by number of sectors or by the +/-<size>{K,B,M,G,...} notation.
- If the size is prefixed by
+then it is interpreted as relative to the partition first sector. โ - If the size is prefixed by
-then it is interpreted as relative to the high limit (last available sector for the partition). โ
In the case the size is specified in bytes, then the number may be followed by the multiplicative suffixes KiB (1024 bytes), MiB (1024*1024 bytes), and so on for GiB, TiB, PiB, EiB, ZiB and YiB. The "iB" is optional, e.g., "K" has the same meaning as "KiB".
The relative sizes if specified with multiplicative suffixes (e.g. +100MiB) are always aligned according to device I/O limits. The +/-<size>{K,B,M,G,...} notation is recommended. ๐
The last sector of the partition is strictly calculated as <start> + <size> (without -1) if the size is specified by the +<sectors> notation. In this case, the size is not aligned to the device I/O limits.
For backward compatibility fdisk also accepts the suffixes KB (1000 bytes), MB (1000*1000 bytes), and so on for GB, TB, PB, EB, ZB and YB. These 10^N suffixes are deprecated. Deprecated, babes. Don't build new stuff on them. ๐
๐ง SCRIPT FILES ๐ง
fdisk allows reading (by 'I' command) sfdisk(8) compatible script files. The script is applied to the in-memory partition table, and then it is possible to modify the partition table before you write it to the device.
And vice-versa โ it is possible to write the current in-memory disk layout to the script file by command 'O'. ๐
The script files are compatible between cfdisk(8), sfdisk(8), fdisk and other libfdisk applications. For more details see sfdisk(8). ๐ซถ
๐ DISK LABELS ๐
okay bestie this is the part where we talk about what's actually inside the first sectors of ur disk, and there are like four whole flavors of label you might meet. let's go ๐
GPT (GUID Partition Table)
GPT is the modern standard for laying out a partition table, periodt. she uses:
- 64-bit logical block addresses
- checksums
- UUIDs
- names for partitions
- an unlimited number of partitions โจ
(okay technically "unlimited" but ngl lots of partitioning tools cap it at 128. still iconic.)
๐ซถ heads up: the first sector is still reserved for a protective MBR in the GPT spec. that's on purpose โ it stops MBR-only partitioning tools from mis-recognizing and straight-up overwriting ur GPT disk. protect the girlies.
GPT is always a better choice than MBR, especially on modern hardware with a UEFI boot loader. no cap.
DOS-type (MBR)
A DOS-type partition table can describe an unlimited number of partitions. in sector 0 there's room for the description of 4 partitions (these are called primary). one of these may be an extended partition โ think of it as a lil box holding logical partitions, with descriptors found in a linked list of sectors, each one sitting right before its corresponding logical partition.
the four primary partitions, whether they're actually present or not, get numbers 1-4. logical partitions start numbering from 5.
so in a DOS-type partition table, the starting offset and the size of each partition gets stored two different ways:
- as an absolute number of sectors (given in 32 bits) โ this one's OK! with 512-byte sectors it'll work up to 2 TB.
- as a Cylinders/Heads/Sectors triple (given in 10+8+6 bits) โ this one has two problems ๐ญ
the C/H/S problems, since u asked:
- these C/H/S fields can only be filled when the number of heads and the number of sectors per track are known.
- even if we do know what those numbers should be, the 24 bits available do not suffice.
DOS uses C/H/S only, Windows uses both, Linux never uses C/H/S. The C/H/S addressing is deprecated and may be unsupported in some later fdisk version. ๐
please read the DOS-mode section if u want DOS-compatible partitions. and fyi, fdisk does not care about cylinder boundaries by default.
BSD/Sun-type
A BSD/Sun disklabel can describe 8 partitions, the third of which should be a whole disk partition.
โ ๏ธ do NOT start a partition that actually uses its first sector (like a swap partition) at cylinder 0, because that will destroy the disklabel. i'm so serious.
note that a BSD label is usually nested within a DOS partition. cute lil nesting doll situation ๐ช
IRIX/SGI-type
An IRIX/SGI disklabel can describe 16 partitions, the eleventh of which should be an entire volume partition, while the ninth should be labeled volume header.
the volume header will also cover the partition table โ i.e., it starts at block zero and extends by default over five cylinders. the remaining space in the volume header may be used by header directory entries.
๐จ no partitions may overlap with the volume header. also do not change its type or make some filesystem on it, since you will lose the partition table. like, gone gone.
use this type of label only when working with Linux on IRIX/SGI machines or IRIX/SGI disks under Linux.
a sync(2) and an ioctl(BLKRRPART) (rereading the partition table from disk) are performed before exiting when the partition table has been updated. โจ
๐ DOS MODE AND DOS 6.X WARNING ๐
ok so first thing: all of this is deprecated. you don't have to care about things like geometry and cylinders on modern operating systems. fr fr.
if u really want DOS-compatible partitioning then you have to enable DOS mode and cylinder units by using the '-c=dos -u=cylinders' fdisk command-line options.
now the messy part. the DOS 6.x FORMAT command looks for some information in the first sector of the data area of the partition, and treats this information as more reliable than the information in the partition table. DOS FORMAT expects DOS FDISK to clear the first 512 bytes of the data area of a partition whenever a size change occurs. DOS FORMAT will look at this extra information even if the /U flag is given โ we consider this a bug in DOS FORMAT and DOS FDISK. ๐
the bottom line, bestie:
if you use fdisk orcfdisk(8)to change the size of a DOS partition table entry, then you must also usedd(1)to zero the first 512 bytes of that partition before using DOS FORMAT to format the partition.
for example, if you were using fdisk to make a DOS partition table entry for /dev/sda1, then (after exiting fdisk and rebooting Linux so that the partition table information is valid) you would use the command
dd if=/dev/zero of=/dev/sda1 bs=512 count=1
to zero the first 512 bytes of the partition. ๐ซถ
fdisk usually obtains the disk geometry automatically. this is not necessarily the physical disk geometry (indeed, modern disks don't really have anything like a physical geometry, certainly not something that can be described in the simplistic Cylinders/Heads/Sectors form), but it is the disk geometry that MS-DOS uses for the partition table.
usually all goes well by default, and there are no problems if Linux is the only system on the disk. however, if the disk has to be shared with other operating systems, it's often a good idea to let an fdisk from another operating system make at least one partition. when Linux boots it looks at the partition table, and tries to deduce what (fake) geometry is required for good cooperation with other systems. ๐ค
whenever a partition table is printed out in DOS mode, a consistency check is performed on the partition table entries. this check verifies that:
- the physical and logical start and end points are identical
- each partition starts and ends on a cylinder boundary (except for the first partition)
some versions of MS-DOS create a first partition which does not begin on a cylinder boundary, but on sector 2 of the first cylinder. partitions beginning in cylinder 1 cannot begin on a cylinder boundary, but this is unlikely to cause difficulty unless you have OS/2 on your machine. ๐
for best results, you should always use an OS-specific partition table program. for example, you should make DOS partitions with the DOS FDISK program and Linux partitions with the Linux fdisk or Linux cfdisk(8) programs. periodt.
๐ COLORS ๐
the output colorization is implemented by terminal-colors.d(5) functionality. implicit coloring can be disabled by an empty file
/etc/terminal-colors.d/fdisk.disable
for the fdisk command, or for all tools by
/etc/terminal-colors.d/disable
since version 2.41, the $NO_COLOR environment variable is also supported to disable output colorization unless explicitly enabled by a command-line option.
the user-specific $XDG_CONFIG_HOME/terminal-colors.d or $HOME/.config/terminal-colors.d overrides the global setting. ๐
note that the output colorization may be enabled by default, and in this case terminal-colors.d directories do not have to exist yet.
the logical color names supported by fdisk are:
headerโ the header of the output tables.help-titleโ the help section titles.warnโ the warning messages.welcomeโ the welcome message.
๐ธ ENVIRONMENT ๐ธ
FDISK_DEBUG=allโ enables fdisk debug output.LIBFDISK_DEBUG=allโ enables libfdisk debug output.LIBBLKID_DEBUG=allโ enables libblkid debug output.LIBSMARTCOLS_DEBUG=allโ enables libsmartcols debug output.LIBSMARTCOLS_DEBUG_PADDING=onโ use visible padding characters.LOCK_BLOCK_DEVICE=<mode>โ use exclusive BSD lock. the mode is"1"or"0". see--lockfor more details.
๐ AUTHORS ๐
Karel Zak <kzak@redhat.com>, Davidlohr Bueso <dave@gnu.org>
the original version was written by Andries E. Brouwer, A. V. Le Blanc and others. legends only ๐ซถ
๐ฆ SEE ALSO ๐ฆ
cfdisk(8), mkfs(8), partx(8), sfdisk(8)
๐ REPORTING BUGS ๐
for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.
โญ AVAILABILITY โญ
the fdisk command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
and that's the whole page bestie!! this one came from util-linux version 2.42.4, dated 2026-09-21 ๐ go partition something responsibly, back up ur data first, and remember: GPT unless u have a very specific reason. slay โจ๐
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms