{
    "mode": "man",
    "parameter": "cgdisk",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/cgdisk/8/json",
    "generated": "2026-10-06T09:52:58Z",
    "synopsis": "cgdisk [ -a ] device",
    "sections": {
        "NAME": {
            "content": "cgdisk - Curses-based GUID partition table (GPT) manipulator\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "cgdisk [ -a ] device\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "GPT  fdisk  is  a text-mode family of programs for creation and manipulation of partition ta‐\nbles. The cgdisk member of this family employs a curses-based user interface for  interaction\nusing  a  text-mode  menuing  system.  It will automatically convert an old-style Master Boot\nRecord (MBR) partition table or BSD disklabel stored without an MBR carrier partition to  the\nnewer  Globally  Unique  Identifier  (GUID) Partition Table (GPT) format, or will load a GUID\npartition table. Other members of this program family are gdisk (the most  feature-rich  pro‐\ngram  of  the group, with a non-curses-based interactive user interface) and sgdisk (which is\ndriven via command-line options for use by experts or in scripts).   FixParts  is  a  related\nprogram for fixing a limited set of problems with MBR disks.\n\nFor  information  on  MBR vs. GPT, as well as GPT terminology and structure, see the extended\nGPT fdisk documentation at https://www.rodsbooks.com/gdisk/ or consult Wikipedia.\n\nThe cgdisk program employs a user interface similar to that of  Linux's  cfdisk,  but  cgdisk\nmodifies  GPT  partitions.  It  also has the capability of transforming MBR partitions or BSD\ndisklabels into GPT partitions. Like the original cfdisk program, cgdisk does not modify disk\nstructures until you explicitly write them to disk, so if you make a mistake,  you  can  exit\nfrom the program with the Quit option to leave your partitions unmodified.\n\nOrdinarily,  cgdisk  operates on disk device files, such as /dev/sda or /dev/hda under Linux,\n/dev/disk0 under Mac OS X, or /dev/ad0 or /dev/da0 under FreeBSD. The program can also  oper‐\nate  on  disk  image  files, which can be either copies of whole disks (made with dd, for in‐\nstance) or raw disk images used by emulators such as QEMU or VMWare. Note that only raw  disk\nimages are supported; cgdisk cannot work on compressed or other advanced disk image formats.\n\nUpon  start,  cgdisk  attempts to identify the partition type in use on the disk. If it finds\nvalid GPT data, cgdisk will use it. If cgdisk finds a valid MBR or BSD disklabel but  no  GPT\ndata,  it  will  attempt  to  convert the MBR or disklabel into GPT form. (BSD disklabels are\nlikely to have unusable first and/or final partitions because they overlap with the GPT  data\nstructures,  though.)  Upon exiting with the 'w' option, cgdisk replaces the MBR or disklabel\nwith a GPT. This action is potentially dangerous! Your system may become unbootable, and par‐\ntition type codes may become corrupted if the disk uses unrecognized type codes.  Boot  prob‐\nlems  are particularly likely if you're multi-booting with any GPT-unaware OS. If you mistak‐\nenly launch cgdisk on an MBR disk, you can safely exit the program without making any changes\nby using the Quit option.\n\nWhen creating a fresh partition table, certain considerations may be in order:\n\n\n*      For data (non-boot) disks, and for boot disks used on BIOS-based computers  with  GRUB\nas  the boot loader, partitions may be created in whatever order and in whatever sizes\nare desired.\n\n\n*      Boot disks for EFI-based systems require an EFI System Partition (GPT  fdisk  internal\ncode  0xEF00)  formatted as FAT-32.  The recommended size of this partition is between\n100 and 300 MiB.  Boot-related files are stored here. (Note that GNU Parted identifies\nsuch partitions as having the \"boot flag\" set.)\n\n\n*      The GRUB 2 boot loader for BIOS-based systems makes use of a BIOS Boot Partition  (GPT\nfdisk internal code 0xEF02), in which the secondary boot loader is stored, without the\nbenefit  of  a filesystem. This partition can typically be quite small (roughly 32 KiB\nto 1 MiB), but you should consult your boot loader documentation for details.\n\n\n*      If Windows is to boot from a GPT disk, a partition of  type  Microsoft  Reserved  (GPT\nfdisk  internal code 0x0C01) is recommended. This partition should be about 128 MiB in\nsize. It ordinarily follows the EFI System Partition and immediately precedes the Win‐\ndows data partitions. (Note that old versions of GNU Parted create all FAT  partitions\nas  this  type, which actually makes the partition unusable for normal file storage in\nboth Windows and Mac OS X.)\n\n\n*      Some OSes' GPT utilities create some blank space (typically 128 MiB) after each parti‐\ntion. The intent is to enable future disk utilities to use this space. Such free space\nis not required of GPT disks, but creating it may help in future disk maintenance. You\ncan use GPT fdisk's relative partition positioning  option  (specifying  the  starting\nsector as '+128M', for instance) to simplify creating such gaps.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Only one command-line option is accepted, aside from the device filename: -a. This option al‐\nters  the highlighting of partitions and blocks of free space: Instead of using ncurses, when\n-a is used cgdisk uses a \">\" symbol to the left of the  selected  partition  or  free  space.\nThis option is intended for use on limited display devices such as teletypes and screen read‐\ners.\n\nInteractions  with  cgdisk occur with its interactive text-mode menus.  The display is broken\ninto two interactive parts:\n\n\n*      The partition display area, in which partitions and gaps between them (marked as \"free\nspace\") are summarized.\n\n\n*      The option selection area, in which buttons for the main options appear.\n\n\nIn addition, the top of the display shows the program's name and version number,  the  device\nfilename  associated  with  the disk, and the disk's size in both sectors and IEEE-1541 units\n(GiB, TiB, and so on).\n\nYou can use the following keys to move among the various options and to select among them:\n\n",
            "subsections": [
                {
                    "name": "up arrow",
                    "content": "This key moves the partition selection up by one partition.\n\n"
                },
                {
                    "name": "down arrow",
                    "content": "This key moves the partition selection down by one partition.\n\n"
                },
                {
                    "name": "Page Up",
                    "content": "This key moves the partition selection up by one screen.\n\n"
                },
                {
                    "name": "Page Down",
                    "content": "This key moves the partition selection down by one screen.\n\n"
                },
                {
                    "name": "right arrow",
                    "content": "This key moves the option selection to the right by one item.\n\n"
                },
                {
                    "name": "left arrow",
                    "content": "This key moves the option selection to the left by one item.\n\n\nEnter  This key activates the currently selected option. You can also activate an  option  by\ntyping the capitalized letter in the option's name on the keyboard, such as a to acti‐\nvate the Align option.\n\n\nIf  more partitions exist than can be displayed in one screen, you can scroll between screens\nusing the partition selection keys, much as in a text editor.\n\nAvailable options are as described below. (Note that cgdisk provides a much more limited  set\nof  options  than  its sibling gdisk. If you need to perform partition table recovery, hybrid\nMBR modification, or other advanced operations, you should consult the gdisk documentation.)\n\n\nAlign  Change the sector alignment value. Disks with more logical sectors than physical  sec‐\ntors  (such  as modern Advanced Format drives), some RAID configurations, and many SSD\ndevices, can suffer performance problems if partitions are not  aligned  properly  for\ntheir  internal  data structures. On new disks, GPT fdisk attempts to align partitions\non 1 MiB boundaries (2048-sectors on disks with 512-byte sectors)  by  default,  which\noptimizes performance for all of these disk types. On pre-partitioned disks, GPT fdisk\nattempts  to  identify  the  alignment  value used on that disk, but will set 8-sector\nalignment on disks larger than 300 GB even if lesser alignment values are detected. In\neither case, it can be changed by using this option.  The alignment value also affects\nthe default end sector value when creating a new partition; it will be aligned to  one\nless  than  a  multiple of the alignment value, when possible. This should keep parti‐\ntions a multiple of the alignment value in size. Some disk  encryption  tools  require\npartitions  to  be sized to some value, typically 4096 bytes, so the default alignment\nof 1 MiB works well for them.\n\n\nBackup Save partition data to a backup file. You can back up your current in-memory partition\ntable to a disk file using this option. The resulting file is a binary file consisting\nof the protective MBR, the main GPT header, the backup GPT header, and one copy of the\npartition table, in that order. Note that the backup is of the current in-memory  data\nstructures,  so if you launch the program, make changes, and then use this option, the\nbackup will reflect your changes.\n\n\nDelete Delete a partition. This action deletes the entry from the partition  table  but  does\nnot  disturb  the data within the sectors originally allocated to the partition on the\ndisk. If a corresponding hybrid MBR partition exists, gdisk deletes it, as  well,  and\nexpands  any  adjacent  0xEE  (EFI  GPT) MBR protective partition to fill the new free\nspace.\n\n\nHelp   Print brief descriptions of all the options.\n\n\nInfo   Show detailed partition information. The summary information shown  in  the  partition\ndisplay  area necessarily omits many details, such as the partitions' unique GUIDs and\nthe partitions' sector-exact start and end points. The Info option displays  this  in‐\nformation for a single partition.\n\n\nLoad   Load  partition  data from a backup file. This option is the reverse of the Backup op‐\ntion. Note that restoring partition data from anything but the original  disk  is  not\nrecommended.\n\n\nnaMe   Change  the  GPT  name  of  a  partition. This name is encoded as a UTF-16 string, but\nproper entry and display of anything beyond basic ASCII values requires  suitable  lo‐\ncale and font support. For the most part, Linux ignores the partition name, but it may\nbe  important  in some OSes. GPT fdisk sets a default name based on the partition type\ncode. Note that the GPT partition name is different from the filesystem name, which is\nencoded in the filesystem's data structures. Note also that to activate this  item  by\ntyping  its alphabetic equivalent, you must use M, not the more obvious N, because the\nlatter is used by the next option....\n\n\nNew    Create a new partition. You enter a starting sector, a size, a type code, and a  name.\nThe  start  sector can be specified in absolute terms as a sector number or as a posi‐\ntion measured in kibibytes (K), mebibytes (M), gibibytes (G), tebibytes  (T),  or  pe‐\nbibytes  (P); for instance, 40M specifies a position 40MiB from the start of the disk.\nYou can specify locations relative to the start or end of the specified default  range\nby  preceding  the number by a '+' symbol, as in +2G to specify a point 2GiB after the\ndefault start sector. The size value can use the K, M, G,  T,  and  P  suffixes,  too.\nPressing  the  Enter key with no input specifies the default value, which is the start\nof the largest available block for the start sector and the full  available  size  for\nthe size.\n\n\nQuit   Quit from the program without saving your changes.  Use this option if you just wanted\nto view information or if you make a mistake and want to back out of all your changes.\n\n\nType   Change  a single partition's type code. You enter the type code using a two-byte hexa‐\ndecimal number. You may also enter a GUID directly, if you have one and cgdisk doesn't\nknow it. If you don't know the type code for your partition, you can type L to  see  a\nlist  of  known type codes.  The type code list may optionally be filtered by a search\nstring; for instance, entering linux shows only partition type codes with descriptions\nthat include the string Linux. This search is performed case-insensitively.\n\n\nVerify Verify disk. This option checks for a variety of problems, such as incorrect CRCs  and\nmismatched main and backup data. This option does not automatically correct most prob‐\nlems,  though;  for  that,  you must use gdisk. If no problems are found, this command\ndisplays a summary of unallocated disk space.\n\n\nWrite  Write data. Use this command to save your changes.\n\n"
                }
            ]
        },
        "BUGS": {
            "content": "Known bugs and limitations include:\n\n\n*      The program compiles correctly only on Linux, FreeBSD, and Mac OS  X.  In  theory,  it\nshould  compile  under  Windows if the Ncurses library for Windows is installed, but I\nhave not tested this capability. Linux versions for x86-64 (64-bit), x86 (32-bit), and\nPowerPC (32-bit) have been tested, with the x86-64 version having seen the most  test‐\ning.  Under  FreeBSD, 32-bit (x86) and 64-bit (x86-64) versions have been tested. Only\n32-bit versions for Mac OS X has been tested by the author.\n\n\n*      The FreeBSD version of the program can't write changes to the  partition  table  to  a\ndisk  when existing partitions on that disk are mounted. (The same problem exists with\nmany other FreeBSD utilities, such as gpt, fdisk, and  dd.)  This  limitation  can  be\novercome by typing sysctl kern.geom.debugflags=16 at a shell prompt.\n\n\n*      The  program  can load only up to 128 partitions (4 primary partitions and 124 logical\npartitions) when converting from MBR format. This limit can be raised by changing  the\n#define  MAXMBRPARTS  line  in the basicmbr.h source code file and recompiling; how‐\never, such a change will require using  a  larger-than-normal  partition  table.  (The\nlimit  of 128 partitions was chosen because that number equals the 128 partitions sup‐\nported by the most common partition table size.)\n\n\n*      Converting from MBR format sometimes fails because of insufficient space at the  start\nor  (more  commonly)  the end of the disk. Resizing the partition table (using the 's'\noption in the experts' menu in gdisk) can sometimes overcome this problem; however, in\nextreme cases it may be necessary to resize a partition using GNU Parted or a  similar\ntool prior to conversion with GPT fdisk.\n\n\n*      MBR conversions work only if the disk has correct LBA partition descriptors. These de‐\nscriptors  should be present on any disk over 8 GiB in size or on smaller disks parti‐\ntioned with any but very ancient software.\n\n\n*      BSD disklabel support can create first and/or last partitions that  overlap  with  the\nGPT  data structures. This can sometimes be compensated by adjusting the partition ta‐\nble size, but in extreme cases the affected partition(s) may need to be deleted.\n\n\n*      Because of the highly variable nature of BSD disklabel  structures,  conversions  from\nthis form may be unreliable -- partitions may be dropped, converted in a way that cre‐\nates  overlaps with other partitions, or converted with incorrect start or end values.\nUse this feature with caution!\n\n\n*      Booting after converting an MBR or BSD disklabel disk is likely to be disrupted. Some‐\ntimes re-installing a boot loader will fix the problem, but other times you  may  need\nto  switch  boot loaders. Except on EFI-based platforms, Windows through at least Win‐\ndows 7 doesn't support booting from GPT disks. Creating a hybrid MBR  (using  the  'h'\noption  on  the recovery & transformation menu in gdisk) or abandoning GPT in favor of\nMBR may be your only options in this case.\n\n\n*      The cgdisk Verify function and the partition type listing obtainable by  typing  L  in\nthe Type function (or when specifying a partition type while creating a new partition)\nboth  currently  exit  ncurses  mode. This limitation is a minor cosmetic blemish that\ndoes not affect functionality.\n\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)\n\nContributors:\n\n* Yves Blusseau (1otnwmz02@sneakemail.com)\n\n* David Hubbard (david.c.hubbard@gmail.com)\n\n* Justin Maggard (justin.maggard@netgear.com)\n\n* Dwight Schauer (das@teegra.net)\n\n* Florian Zumbiehl (florz@florz.de)\n\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "cfdisk(8), fdisk(8), gdisk(8), mkfs(8), parted(8), sfdisk(8), sgdisk(8), fixparts(8).\n\nhttps://en.wikipedia.org/wiki/GUIDPartitionTable\n\nhttps://developer.apple.com/technotes/tn2006/tn2166.html\n\nhttps://www.rodsbooks.com/gdisk/\n\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "The cgdisk command is part of the GPT fdisk package and is available from Rod Smith.\n\nRoderick W. Smith                              1.0.10                                      CGDISK(8)",
            "subsections": []
        }
    },
    "summary": "cgdisk - Curses-based GUID partition table (GPT) manipulator",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "cfdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/cfdisk/8/json"
        },
        {
            "name": "fdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fdisk/8/json"
        },
        {
            "name": "gdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/gdisk/8/json"
        },
        {
            "name": "mkfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/mkfs/8/json"
        },
        {
            "name": "parted",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/parted/8/json"
        },
        {
            "name": "sfdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sfdisk/8/json"
        },
        {
            "name": "sgdisk",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sgdisk/8/json"
        },
        {
            "name": "fixparts",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fixparts/8/json"
        }
    ]
}