{
    "mode": "man",
    "parameter": "fdisk",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/fdisk/8/json",
    "generated": "2026-06-14T01:12:38Z",
    "synopsis": "fdisk [options] device\nfdisk -l [device...]",
    "sections": {
        "NAME": {
            "content": "fdisk - manipulate disk partition table\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "fdisk [options] device\n\nfdisk -l [device...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "fdisk is a dialog-driven program for creation and manipulation of partition tables. It\nunderstands GPT, MBR, Sun, SGI and BSD partition tables.\n\nBlock devices can be divided into one or more logical disks called partitions. This division\nis recorded in the partition table, usually found in sector 0 of the disk. (In the BSD world\none talks about `disk slices' and a `disklabel'.)\n\nAll partitioning is driven by device I/O limits (the topology) by default. fdisk is able to\noptimize the disk layout for a 4K-sector size and use an alignment offset on modern devices\nfor MBR and GPT. It is always a good idea to follow fdisk's defaults as the default values\n(e.g., first and last partition sectors) and partition sizes specified by the\n+/-<size>{M,G,...} notation are always aligned according to the device properties.\n\nCHS (Cylinder-Head-Sector) addressing is deprecated and not used by default. Please, do not\nfollow old articles and recommendations with fdisk -S <n> -H <n> advices for SSD or 4K-sector\ndevices.\n\nNote that partx(8) provides a rich interface for scripts to print disk layouts, fdisk is\nmostly designed for humans. Backward compatibility in the output of fdisk is not guaranteed.\nThe input (the commands) should always be backward compatible.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-b --sector-size",
                    "content": "Specify the sector size of the disk. Valid values are 512, 1024, 2048, and 4096. (Recent\nkernels know the sector size. Use this option only on old kernels or to override the\nkernel’s ideas.) Since util-linux-2.17, fdisk differentiates between logical and physical\nsector size. This option changes both sector sizes to sectorsize.\n",
                    "flag": "-b",
                    "long": "--sector-size"
                },
                {
                    "name": "-B --protect-boot",
                    "content": "Don’t erase the beginning of the first disk sector when creating a new disk label. This\nfeature is supported for GPT and MBR.\n",
                    "flag": "-B",
                    "long": "--protect-boot"
                },
                {
                    "name": "-c --compatibility",
                    "content": "Specify the compatibility mode, 'dos' or 'nondos'. The default is non-DOS mode. For\nbackward compatibility, it is possible to use the option without the mode argument — then\nthe default is used. Note that the optional mode argument cannot be separated from the -c\noption by a space, the correct form is for example -c=dos.\n",
                    "flag": "-c",
                    "long": "--compatibility"
                },
                {
                    "name": "-h --help",
                    "content": "Display a help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "-L --color",
                    "content": "Colorize the output. The optional argument when can be auto, never or always. If the when\nargument is omitted, it defaults to auto. The colors can be disabled; for the current\nbuilt-in default see the --help output. See also the COLORS section.\n",
                    "flag": "-L",
                    "long": "--color"
                },
                {
                    "name": "-l --list",
                    "content": "List the partition tables for the specified devices and then exit.\n\nIf no devices are given, the devices mentioned in /proc/partitions (if this file exists)\nare used. Devices are always listed in the order in which they are specified on the\ncommand-line, or by the kernel listed in /proc/partitions.\n",
                    "flag": "-l",
                    "long": "--list"
                },
                {
                    "name": "-x --list-details",
                    "content": "Like --list, but provides more details.\n\n--lock[=mode]\nUse exclusive BSD lock for device or file it operates. The optional argument mode can be\nyes, no (or 1 and 0) or nonblock. If the mode argument is omitted, it defaults to \"yes\".\nThis option overwrites environment variable $LOCKBLOCKDEVICE. The default is not to use\nany lock at all, but it’s recommended to avoid collisions with udevd or other tools.\n",
                    "flag": "-x",
                    "long": "--list-details"
                },
                {
                    "name": "-n --noauto-pt",
                    "content": "Don’t automatically create a default partition table on empty device. The partition table\nhas to be explicitly created by user (by command like 'o', 'g', etc.).\n",
                    "flag": "-n",
                    "long": "--noauto-pt"
                },
                {
                    "name": "-o --output",
                    "content": "Specify which output columns to print. Use --help to get a list of all supported columns.\n\nThe default list of columns may be extended if list is specified in the format +list\n(e.g., -o +UUID).\n",
                    "flag": "-o",
                    "long": "--output"
                },
                {
                    "name": "-s --getsz",
                    "content": "Print the size in 512-byte sectors of each given block device. This option is DEPRECATED\nin favour of blockdev(8).\n",
                    "flag": "-s",
                    "long": "--getsz"
                },
                {
                    "name": "-t --type",
                    "content": "Enable support only for disklabels of the specified type, and disable support for all\nother types.\n",
                    "flag": "-t",
                    "long": "--type"
                },
                {
                    "name": "-u --units",
                    "content": "When listing partition tables, show sizes in 'sectors' or in 'cylinders'. The default is\nto show sizes in sectors. For backward compatibility, it is possible to use the option\nwithout the unit argument — then the default is used. Note that the optional unit\nargument cannot be separated from the -u option by a space, the correct form is for\nexample '*-u=*cylinders'.\n",
                    "flag": "-u",
                    "long": "--units"
                },
                {
                    "name": "-C --cylinders",
                    "content": "Specify the number of cylinders of the disk. I have no idea why anybody would want to do\nso.\n",
                    "flag": "-C",
                    "long": "--cylinders"
                },
                {
                    "name": "-H --heads",
                    "content": "Specify the number of heads of the disk. (Not the physical number, of course, but the\nnumber used for partition tables.) Reasonable values are 255 and 16.\n",
                    "flag": "-H",
                    "long": "--heads"
                },
                {
                    "name": "-S --sectors",
                    "content": "Specify the number of sectors per track of the disk. (Not the physical number, of course,\nbut the number used for partition tables.) A reasonable value is 63.\n",
                    "flag": "-S",
                    "long": "--sectors"
                },
                {
                    "name": "-w --wipe",
                    "content": "Wipe filesystem, RAID and partition-table signatures from the device, in order to avoid\npossible collisions. The argument when can be auto, never or always. When this option is\nnot given, the default is auto, in which case signatures are wiped only when in\ninteractive mode. In all cases detected signatures are reported by warning messages\nbefore a new partition table is created. See also wipefs(8) command.\n",
                    "flag": "-w",
                    "long": "--wipe"
                },
                {
                    "name": "-W --wipe-partitions",
                    "content": "Wipe filesystem, RAID and partition-table signatures from a newly created partitions, in\norder to avoid possible collisions. The argument when can be auto, never or always. When\nthis option is not given, the default is auto, in which case signatures are wiped only\nwhen in interactive mode and after confirmation by user. In all cases detected signatures\nare reported by warning messages before a new partition is created. See also wipefs(8)\ncommand.\n",
                    "flag": "-W",
                    "long": "--wipe-partitions"
                },
                {
                    "name": "-V --version",
                    "content": "Display version information and exit.\n",
                    "flag": "-V",
                    "long": "--version"
                }
            ]
        },
        "DEVICES": {
            "content": "The device is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk. Old\nsystems without libata (a library used inside the Linux kernel to support ATA host\ncontrollers and devices) make a difference between IDE and SCSI disks. In such cases the\ndevice name will be /dev/hd* (IDE) or /dev/sd* (SCSI).\n\nThe partition is a device name followed by a partition number. For example, /dev/sda1 is the\nfirst partition on the first hard disk in the system. See also Linux kernel documentation\n(the Documentation/admin-guide/devices.txt file).\n",
            "subsections": []
        },
        "SIZES": {
            "content": "The \"last sector\" dialog accepts partition size specified by number of sectors or by\n+/-<size>{K,B,M,G,...} notation.\n\nIf the size is prefixed by '+' then it is interpreted as relative to the partition first\nsector. If the size is prefixed by '-' then it is interpreted as relative to the high limit\n(last available sector for the partition).\n\nIn the case the size is specified in bytes than the number may be followed by the\nmultiplicative suffixes KiB=1024, MiB=1024*1024, and so on for GiB, TiB, PiB, EiB, ZiB and\nYiB. The \"iB\" is optional, e.g., \"K\" has the same meaning as \"KiB\".\n\nThe relative sizes are always aligned according to device I/O limits. The\n+/-<size>{K,B,M,G,...} notation is recommended.\n\nFor backward compatibility fdisk also accepts the suffixes KB=1000, MB=1000*1000, and so on\nfor GB, TB, PB, EB, ZB and YB. These 10^N suffixes are deprecated.\n",
            "subsections": []
        },
        "SCRIPT FILES": {
            "content": "fdisk allows reading (by 'I' command) sfdisk(8) compatible script files. The script is\napplied to in-memory partition table, and then it is possible to modify the partition table\nbefore you write it to the device.\n\nAnd vice-versa it is possible to write the current in-memory disk layout to the script file\nby command 'O'.\n\nThe script files are compatible between cfdisk(8), sfdisk(8), fdisk and other libfdisk\napplications. For more details see sfdisk(8).\n",
            "subsections": []
        },
        "DISK LABELS": {
            "content": "",
            "subsections": [
                {
                    "name": "GPT (GUID Partition Table)",
                    "content": "GPT is modern standard for the layout of the partition table. GPT uses 64-bit logical\nblock addresses, checksums, UUIDs and names for partitions and an unlimited number of\npartitions (although the number of partitions is usually restricted to 128 in many\npartitioning tools).\n\nNote that the first sector is still reserved for a protective MBR in the GPT\nspecification. It prevents MBR-only partitioning tools from mis-recognizing and\noverwriting GPT disks.\n\nGPT is always a better choice than MBR, especially on modern hardware with a UEFI boot\nloader.\n"
                },
                {
                    "name": "DOS-type (MBR)",
                    "content": "A DOS-type partition table can describe an unlimited number of partitions. In sector 0\nthere is room for the description of 4 partitions (called `primary'). One of these may be\nan extended partition; this is a box holding logical partitions, with descriptors found\nin a linked list of sectors, each preceding the corresponding logical partitions. The\nfour primary partitions, present or not, get numbers 1-4. Logical partitions are numbered\nstarting from 5.\n\nIn a DOS-type partition table the starting offset and the size of each partition is\nstored in two ways: as an absolute number of sectors (given in 32 bits), and as a\nCylinders/Heads/Sectors triple (given in 10+8+6 bits). The former is OK — with 512-byte\nsectors this will work up to 2 TB. The latter has two problems. First, these C/H/S fields\ncan be filled only when the number of heads and the number of sectors per track are\nknown. And second, even if we know what these numbers should be, the 24 bits that are\navailable do not suffice. DOS uses C/H/S only, Windows uses both, Linux never uses C/H/S.\nThe C/H/S addressing is deprecated and may be unsupported in some later fdisk version.\n\nPlease, read the DOS-mode section if you want DOS-compatible partitions. fdisk does not\ncare about cylinder boundaries by default.\n"
                },
                {
                    "name": "BSD/Sun-type",
                    "content": "A BSD/Sun disklabel can describe 8 partitions, the third of which should be a `whole\ndisk' partition. Do not start a partition that actually uses its first sector (like a\nswap partition) at cylinder 0, since that will destroy the disklabel. Note that a BSD\nlabel is usually nested within a DOS partition.\n"
                },
                {
                    "name": "IRIX/SGI-type",
                    "content": "An IRIX/SGI disklabel can describe 16 partitions, the eleventh of which should be an\nentire `volume' partition, while the ninth should be labeled `volume header'. The volume\nheader will also cover the partition table, i.e., it starts at block zero and extends by\ndefault over five cylinders. The remaining space in the volume header may be used by\nheader directory entries. No partitions may overlap with the volume header. Also do not\nchange its type or make some filesystem on it, since you will lose the partition table.\nUse this type of label only when working with Linux on IRIX/SGI machines or IRIX/SGI\ndisks under Linux.\n\nA sync() and an ioctl(BLKRRPART) (rereading the partition table from disk) are performed\nbefore exiting when the partition table has been updated.\n"
                },
                {
                    "name": "DOS MODE AND DOS 6.X WARNING",
                    "content": "Note that all this is deprecated. You don’’t have to care about things like geometry and"
                },
                {
                    "name": "cylinders on modern operating systems. If you really want DOS-compatible partitioning then",
                    "content": ""
                },
                {
                    "name": "you have to enable DOS mode and cylinder units by using the '-c=dos -u=cylinders' fdisk",
                    "content": ""
                },
                {
                    "name": "command-line options.",
                    "content": "The DOS 6.x FORMAT command looks for some information in the first sector of the data area of\nthe partition, and treats this information as more reliable than the information in the\npartition table. DOS FORMAT expects DOS FDISK to clear the first 512 bytes of the data area\nof a partition whenever a size change occurs. DOS FORMAT will look at this extra information\neven if the /U flag is given — we consider this a bug in DOS FORMAT and DOS FDISK.\n\nThe bottom line is that if you use fdisk or cfdisk to change the size of a DOS partition\ntable entry, then you must also use dd(1) to zero the first 512 bytes of that partition\nbefore using DOS FORMAT to format the partition. For example, if you were using fdisk to make\na DOS partition table entry for /dev/sda1, then (after exiting fdisk and rebooting Linux so\nthat the partition table information is valid) you would use the command dd if=/dev/zero\nof=/dev/sda1 bs=512 count=1 to zero the first 512 bytes of the partition.\n\nfdisk usually obtains the disk geometry automatically. This is not necessarily the physical\ndisk geometry (indeed, modern disks do not really have anything like a physical geometry,\ncertainly not something that can be described in the simplistic Cylinders/Heads/Sectors\nform), but it is the disk geometry that MS-DOS uses for the partition table.\n\nUsually all goes well by default, and there are no problems if Linux is the only system on\nthe disk. However, if the disk has to be shared with other operating systems, it is often a\ngood idea to let an fdisk from another operating system make at least one partition. When\nLinux boots it looks at the partition table, and tries to deduce what (fake) geometry is\nrequired for good cooperation with other systems.\n\nWhenever a partition table is printed out in DOS mode, a consistency check is performed on\nthe partition table entries. This check verifies that the physical and logical start and end\npoints are identical, and that each partition starts and ends on a cylinder boundary (except\nfor the first partition).\n\nSome versions of MS-DOS create a first partition which does not begin on a cylinder boundary,\nbut on sector 2 of the first cylinder. Partitions beginning in cylinder 1 cannot begin on a\ncylinder boundary, but this is unlikely to cause difficulty unless you have OS/2 on your\nmachine.\n\nFor best results, you should always use an OS-specific partition table program. For example,\nyou should make DOS partitions with the DOS FDISK program and Linux partitions with the Linux\nfdisk or Linux cfdisk(8) programs.\n"
                }
            ]
        },
        "COLORS": {
            "content": "Implicit coloring can be disabled by an empty file /etc/terminal-colors.d/fdisk.disable.\n\nSee terminal-colors.d(5) for more details about colorization configuration. The logical color\nnames supported by fdisk are:\n",
            "subsections": [
                {
                    "name": "header",
                    "content": "The header of the output tables.\n"
                },
                {
                    "name": "help-title",
                    "content": "The help section titles.\n"
                },
                {
                    "name": "warn",
                    "content": "The warning messages.\n"
                },
                {
                    "name": "welcome",
                    "content": "The welcome message.\n"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "FDISKDEBUG=all\nenables fdisk debug output.\n\nLIBFDISKDEBUG=all\nenables libfdisk debug output.\n\nLIBBLKIDDEBUG=all\nenables libblkid debug output.\n\nLIBSMARTCOLSDEBUG=all\nenables libsmartcols debug output.\n\nLIBSMARTCOLSDEBUGPADDING=on\nuse visible padding characters.\n\nLOCKBLOCKDEVICE=<mode>\nuse exclusive BSD lock. The mode is \"1\" or \"0\". See --lock for more details.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Karel Zak <kzak@redhat.com>, Davidlohr Bueso <dave@gnu.org>\n\nThe original version was written by Andries E. Brouwer, A. V. Le Blanc and others.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "cfdisk(8), mkfs(8), partx(8), sfdisk(8)\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "For bug reports, use the issue tracker at https://github.com/karelzak/util-linux/issues.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The fdisk command is part of the util-linux package which can be downloaded from Linux Kernel\nArchive <https://www.kernel.org/pub/linux/utils/util-linux/>.\n\n\n\nutil-linux 2.37.2                            2021-08-16                                     FDISK(8)",
            "subsections": []
        }
    },
    "summary": "fdisk - manipulate disk partition table",
    "flags": [
        {
            "flag": "-b",
            "long": "--sector-size",
            "arg": null,
            "description": "Specify the sector size of the disk. Valid values are 512, 1024, 2048, and 4096. (Recent kernels know the sector size. Use this option only on old kernels or to override the kernel’s ideas.) Since util-linux-2.17, fdisk differentiates between logical and physical sector size. This option changes both sector sizes to sectorsize."
        },
        {
            "flag": "-B",
            "long": "--protect-boot",
            "arg": null,
            "description": "Don’t erase the beginning of the first disk sector when creating a new disk label. This feature is supported for GPT and MBR."
        },
        {
            "flag": "-c",
            "long": "--compatibility",
            "arg": null,
            "description": "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 -c option by a space, the correct form is for example -c=dos."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display a help text and exit."
        },
        {
            "flag": "-L",
            "long": "--color",
            "arg": null,
            "description": "Colorize the output. The optional argument when can be auto, never or always. If the when argument is omitted, it defaults to auto. The colors can be disabled; for the current built-in default see the --help output. See also the COLORS section."
        },
        {
            "flag": "-l",
            "long": "--list",
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-x",
            "long": "--list-details",
            "arg": null,
            "description": "Like --list, but provides more details. --lock[=mode] Use exclusive BSD lock for device or file it operates. The optional argument mode can be yes, no (or 1 and 0) or nonblock. If the mode argument is omitted, it defaults to \"yes\". This option overwrites environment variable $LOCKBLOCKDEVICE. The default is not to use any lock at all, but it’s recommended to avoid collisions with udevd or other tools."
        },
        {
            "flag": "-n",
            "long": "--noauto-pt",
            "arg": null,
            "description": "Don’t automatically create a default partition table on empty device. The partition table has to be explicitly created by user (by command like 'o', 'g', etc.)."
        },
        {
            "flag": "-o",
            "long": "--output",
            "arg": null,
            "description": "Specify which output columns to print. Use --help to 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)."
        },
        {
            "flag": "-s",
            "long": "--getsz",
            "arg": null,
            "description": "Print the size in 512-byte sectors of each given block device. This option is DEPRECATED in favour of blockdev(8)."
        },
        {
            "flag": "-t",
            "long": "--type",
            "arg": null,
            "description": "Enable support only for disklabels of the specified type, and disable support for all other types."
        },
        {
            "flag": "-u",
            "long": "--units",
            "arg": null,
            "description": "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 -u option by a space, the correct form is for example '*-u=*cylinders'."
        },
        {
            "flag": "-C",
            "long": "--cylinders",
            "arg": null,
            "description": "Specify the number of cylinders of the disk. I have no idea why anybody would want to do so."
        },
        {
            "flag": "-H",
            "long": "--heads",
            "arg": null,
            "description": "Specify the number of heads of the disk. (Not the physical number, of course, but the number used for partition tables.) Reasonable values are 255 and 16."
        },
        {
            "flag": "-S",
            "long": "--sectors",
            "arg": null,
            "description": "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 is 63."
        },
        {
            "flag": "-w",
            "long": "--wipe",
            "arg": null,
            "description": "Wipe filesystem, RAID and partition-table signatures from the device, in order to avoid possible collisions. The argument when can be auto, never or always. When this option is not given, the default is auto, 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 also wipefs(8) command."
        },
        {
            "flag": "-W",
            "long": "--wipe-partitions",
            "arg": null,
            "description": "Wipe filesystem, RAID and partition-table signatures from a newly created partitions, in order to avoid possible collisions. The argument when can be auto, never or always. When this option is not given, the default is auto, 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 also wipefs(8) command."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Display version information and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "cfdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/cfdisk/8/json"
        },
        {
            "name": "mkfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs/8/json"
        },
        {
            "name": "partx",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/partx/8/json"
        },
        {
            "name": "sfdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sfdisk/8/json"
        }
    ]
}