1CGDISK(8)                      GPT fdisk Manual                      CGDISK(8)
2
3
4

NAME

6       cgdisk - Curses-based GUID partition table (GPT) manipulator
7

SYNOPSIS

9       cgdisk [ -a ] device
10
11

DESCRIPTION

13       GPT  fdisk is a text-mode family of programs for creation and manipula‐
14       tion of partition tables. The cgdisk member of this  family  employs  a
15       curses-based  user  interface for interaction using a text-mode menuing
16       system. It will automatically convert an old-style Master  Boot  Record
17       (MBR)  partition  table  or BSD disklabel stored without an MBR carrier
18       partition to the newer Globally Unique Identifier (GUID) Partition  Ta‐
19       ble (GPT) format, or will load a GUID partition table. Other members of
20       this program family are gdisk (the most  feature-rich  program  of  the
21       group,  with  a non-curses-based interactive user interface) and sgdisk
22       (which is driven via command-line options for  use  by  experts  or  in
23       scripts).   FixParts  is  a related program for fixing a limited set of
24       problems with MBR disks.
25
26       For information on MBR vs. GPT, as well as GPT terminology  and  struc‐
27       ture,  see  the  extended  GPT  fdisk documentation at http://www.rods
28       books.com/gdisk/ or consult Wikipedia.
29
30       The cgdisk program employs a user interface similar to that of  Linux's
31       cfdisk,  but cgdisk modifies GPT partitions. It also has the capability
32       of transforming MBR partitions or BSD disklabels into  GPT  partitions.
33       Like  the  original  cfdisk program, cgdisk does not modify disk struc‐
34       tures until you explicitly write them to disk, so if you  make  a  mis‐
35       take,  you can exit from the program with the Quit option to leave your
36       partitions unmodified.
37
38       Ordinarily, cgdisk operates on disk device files, such as  /dev/sda  or
39       /dev/hda  under  Linux,  /dev/disk0  under  Mac  OS  X,  or /dev/ad0 or
40       /dev/da0 under FreeBSD. The program can  also  operate  on  disk  image
41       files, which can be either copies of whole disks (made with dd, for in‐
42       stance) or raw disk images used by emulators such as  QEMU  or  VMWare.
43       Note  that  only  raw  disk images are supported; cgdisk cannot work on
44       compressed or other advanced disk image formats.
45
46       Upon start, cgdisk attempts to identify the partition type  in  use  on
47       the  disk.  If  it  finds valid GPT data, cgdisk will use it. If cgdisk
48       finds a valid MBR or BSD disklabel but no GPT data, it will attempt  to
49       convert  the MBR or disklabel into GPT form. (BSD disklabels are likely
50       to have unusable first and/or final  partitions  because  they  overlap
51       with  the  GPT  data structures, though.) Upon exiting with the 'w' op‐
52       tion, cgdisk replaces the MBR or disklabel with a GPT. This  action  is
53       potentially dangerous! Your system may become unbootable, and partition
54       type codes may become corrupted if  the  disk  uses  unrecognized  type
55       codes.   Boot  problems are particularly likely if you're multi-booting
56       with any GPT-unaware OS. If you mistakenly  launch  cgdisk  on  an  MBR
57       disk, you can safely exit the program without making any changes by us‐
58       ing the Quit option.
59
60       When creating a fresh partition table, certain considerations may be in
61       order:
62
63
64       *      For data (non-boot) disks, and for boot disks used on BIOS-based
65              computers with GRUB as the boot loader, partitions may  be  cre‐
66              ated in whatever order and in whatever sizes are desired.
67
68
69       *      Boot disks for EFI-based systems require an EFI System Partition
70              (GPT fdisk internal code 0xEF00) formatted as FAT-32.  The  rec‐
71              ommended  size  of  this  partition  is between 100 and 300 MiB.
72              Boot-related files are stored here. (Note that GNU Parted  iden‐
73              tifies such partitions as having the "boot flag" set.)
74
75
76       *      The  GRUB  2  boot  loader for BIOS-based systems makes use of a
77              BIOS Boot Partition (GPT fdisk internal code 0xEF02),  in  which
78              the  secondary  boot  loader is stored, without the benefit of a
79              filesystem. This partition can typically be quite small (roughly
80              32  KiB to 1 MiB), but you should consult your boot loader docu‐
81              mentation for details.
82
83
84       *      If Windows is to boot from a GPT disk, a partition of  type  Mi‐
85              crosoft  Reserved  (GPT  fdisk  internal  code 0x0C01) is recom‐
86              mended. This partition should be about 128 MiB in size. It ordi‐
87              narily follows the EFI System Partition and immediately precedes
88              the Windows data partitions. (Note  that  old  versions  of  GNU
89              Parted  create  all  FAT partitions as this type, which actually
90              makes the partition unusable for normal  file  storage  in  both
91              Windows and Mac OS X.)
92
93
94       *      Some  OSes' GPT utilities create some blank space (typically 128
95              MiB) after each partition. The intent is to enable  future  disk
96              utilities  to use this space. Such free space is not required of
97              GPT disks, but creating it may help in future disk  maintenance.
98              You  can  use  GPT fdisk's relative partition positioning option
99              (specifying the starting sector as  '+128M',  for  instance)  to
100              simplify creating such gaps.
101
102

OPTIONS

104       Only  one  command-line option is accepted, aside from the device file‐
105       name: -a. This option alters the highlighting of partitions and  blocks
106       of  free space: Instead of using ncurses, when -a is used cgdisk uses a
107       ">" symbol to the left of the selected partition or free  space.   This
108       option is intended for use on limited display devices such as teletypes
109       and screen readers.
110
111       Interactions with cgdisk occur with its  interactive  text-mode  menus.
112       The display is broken into two interactive parts:
113
114
115       *      The partition display area, in which partitions and gaps between
116              them (marked as "free space") are summarized.
117
118
119       *      The option selection area, in which buttons for the main options
120              appear.
121
122
123       In  addition,  the top of the display shows the program's name and ver‐
124       sion number, the device filename associated  with  the  disk,  and  the
125       disk's size in both sectors and IEEE-1541 units (GiB, TiB, and so on).
126
127       You can use the following keys to move among the various options and to
128       select among them:
129
130
131       up arrow
132              This key moves the partition selection up by one partition.
133
134
135       down arrow
136              This key moves the partition selection down by one partition.
137
138
139       Page Up
140              This key moves the partition selection up by one screen.
141
142
143       Page Down
144              This key moves the partition selection down by one screen.
145
146
147       right arrow
148              This key moves the option selection to the right by one item.
149
150
151       left arrow
152              This key moves the option selection to the left by one item.
153
154
155       Enter  This key activates the currently selected option. You  can  also
156              activate  an  option by typing the capitalized letter in the op‐
157              tion's name on the keyboard, such as a to activate the Align op‐
158              tion.
159
160
161       If  more  partitions exist than can be displayed in one screen, you can
162       scroll between screens using the partition selection keys, much as in a
163       text editor.
164
165       Available  options are as described below. (Note that cgdisk provides a
166       much more limited set of options than its sibling gdisk. If you need to
167       perform partition table recovery, hybrid MBR modification, or other ad‐
168       vanced operations, you should consult the gdisk documentation.)
169
170
171       Align  Change the sector alignment value. Disks with more logical  sec‐
172              tors  than  physical  sectors  (such  as  modern Advanced Format
173              drives), some RAID configurations, and  many  SSD  devices,  can
174              suffer  performance problems if partitions are not aligned prop‐
175              erly for their internal data structures. On new disks, GPT fdisk
176              attempts  to  align partitions on 1 MiB boundaries (2048-sectors
177              on disks with 512-byte sectors) by default, which optimizes per‐
178              formance  for all of these disk types. On pre-partitioned disks,
179              GPT fdisk attempts to identify the alignment value used on  that
180              disk,  but  will set 8-sector alignment on disks larger than 300
181              GB even if lesser alignment values are detected. In either case,
182              it  can  be  changed  by using this option.  The alignment value
183              also affects the default end sector value when  creating  a  new
184              partition; it will be aligned to one less than a multiple of the
185              alignment value, when possible. This should  keep  partitions  a
186              multiple  of  the  alignment value in size. Some disk encryption
187              tools require partitions to be sized to  some  value,  typically
188              4096  bytes,  so  the  default alignment of 1 MiB works well for
189              them.
190
191
192       Backup Save partition data to a backup file. You can back up your  cur‐
193              rent in-memory partition table to a disk file using this option.
194              The resulting file is a binary file consisting of the protective
195              MBR, the main GPT header, the backup GPT header, and one copy of
196              the partition table, in that order. Note that the backup  is  of
197              the current in-memory data structures, so if you launch the pro‐
198              gram, make changes, and then use this option,  the  backup  will
199              reflect your changes.
200
201
202       Delete Delete  a partition. This action deletes the entry from the par‐
203              tition table but does not disturb the data  within  the  sectors
204              originally  allocated  to the partition on the disk. If a corre‐
205              sponding hybrid MBR partition exists, gdisk deletes it, as well,
206              and expands any adjacent 0xEE (EFI GPT) MBR protective partition
207              to fill the new free space.
208
209
210       Help   Print brief descriptions of all the options.
211
212
213       Info   Show detailed partition  information.  The  summary  information
214              shown  in  the partition display area necessarily omits many de‐
215              tails, such as the partitions' unique GUIDs and the  partitions'
216              sector-exact start and end points. The Info option displays this
217              information for a single partition.
218
219
220       Load   Load partition data from a backup file. This option is  the  re‐
221              verse  of  the Backup option. Note that restoring partition data
222              from anything but the original disk is not recommended.
223
224
225       naMe   Change the GPT name of a partition. This name is  encoded  as  a
226              UTF-16  string,  but proper entry and display of anything beyond
227              basic ASCII values requires suitable locale  and  font  support.
228              For  the most part, Linux ignores the partition name, but it may
229              be important in some OSes. GPT fdisk sets a default  name  based
230              on  the partition type code. Note that the GPT partition name is
231              different from the filesystem name,  which  is  encoded  in  the
232              filesystem's  data  structures.  Note also that to activate this
233              item by typing its alphabetic equivalent, you must  use  M,  not
234              the  more  obvious N, because the latter is used by the next op‐
235              tion....
236
237
238       New    Create a new partition. You enter a starting sector, a  size,  a
239              type  code, and a name. The start sector can be specified in ab‐
240              solute terms as a sector number or as  a  position  measured  in
241              kibibytes  (K),  mebibytes (M), gibibytes (G), tebibytes (T), or
242              pebibytes (P); for instance, 40M specifies a position 40MiB from
243              the start of the disk. You can specify locations relative to the
244              start or end of the specified default  range  by  preceding  the
245              number  by a '+' symbol, as in +2G to specify a point 2GiB after
246              the default start sector. The size value can use the K, M, G, T,
247              and P suffixes, too. Pressing the Enter key with no input speci‐
248              fies the default value, which is the start of the largest avail‐
249              able  block for the start sector and the full available size for
250              the size.
251
252
253       Quit   Quit from the program without saving your changes.  Use this op‐
254              tion  if  you  just  wanted to view information or if you make a
255              mistake and want to back out of all your changes.
256
257
258       Type   Change a single partition's type code. You enter the  type  code
259              using  a  two-byte hexadecimal number. You may also enter a GUID
260              directly, if you have one and cgdisk doesn't  know  it.  If  you
261              don't  know  the type code for your partition, you can type L to
262              see a list of known type codes.  The type code list may  option‐
263              ally  be  filtered  by  a  search string; for instance, entering
264              linux shows only partition type codes with descriptions that in‐
265              clude  the  string Linux. This search is performed case-insensi‐
266              tively.
267
268
269       Verify Verify disk. This option checks for a variety of problems,  such
270              as  incorrect CRCs and mismatched main and backup data. This op‐
271              tion does not automatically correct most problems,  though;  for
272              that, you must use gdisk. If no problems are found, this command
273              displays a summary of unallocated disk space.
274
275
276       Write  Write data. Use this command to save your changes.
277
278

BUGS

280       Known bugs and limitations include:
281
282
283       *      The program compiles correctly only on Linux, FreeBSD,  and  Mac
284              OS  X. In theory, it should compile under Windows if the Ncurses
285              library for Windows is installed, but I have not tested this ca‐
286              pability.  Linux versions for x86-64 (64-bit), x86 (32-bit), and
287              PowerPC (32-bit) have been tested, with the x86-64 version  hav‐
288              ing  seen  the  most  testing.  Under  FreeBSD, 32-bit (x86) and
289              64-bit (x86-64) versions have been tested. Only 32-bit  versions
290              for Mac OS X has been tested by the author.
291
292
293       *      The  FreeBSD  version  of the program can't write changes to the
294              partition table to a disk when existing partitions on that  disk
295              are  mounted.  (The  same problem exists with many other FreeBSD
296              utilities, such as gpt, fdisk, and dd.) This limitation  can  be
297              overcome  by  typing  sysctl  kern.geom.debugflags=16 at a shell
298              prompt.
299
300
301       *      The program can load only up to 128 partitions (4 primary parti‐
302              tions  and 124 logical partitions) when converting from MBR for‐
303              mat.  This  limit  can  be  raised  by  changing   the   #define
304              MAX_MBR_PARTS line in the basicmbr.h source code file and recom‐
305              piling;  however,  such  a   change   will   require   using   a
306              larger-than-normal partition table. (The limit of 128 partitions
307              was chosen because that number equals the  128  partitions  sup‐
308              ported by the most common partition table size.)
309
310
311       *      Converting  from  MBR format sometimes fails because of insuffi‐
312              cient space at the start or (more commonly) the end of the disk.
313              Resizing  the  partition  table (using the 's' option in the ex‐
314              perts' menu in gdisk) can sometimes overcome this problem;  how‐
315              ever, in extreme cases it may be necessary to resize a partition
316              using GNU Parted or a similar tool prior to conversion with  GPT
317              fdisk.
318
319
320       *      MBR  conversions work only if the disk has correct LBA partition
321              descriptors. These descriptors should be  present  on  any  disk
322              over  8 GiB in size or on smaller disks partitioned with any but
323              very ancient software.
324
325
326       *      BSD disklabel support can create first  and/or  last  partitions
327              that overlap with the GPT data structures. This can sometimes be
328              compensated by adjusting the partition table size,  but  in  ex‐
329              treme cases the affected partition(s) may need to be deleted.
330
331
332       *      Because  of  the  highly variable nature of BSD disklabel struc‐
333              tures, conversions from this form may be  unreliable  --  parti‐
334              tions  may  be dropped, converted in a way that creates overlaps
335              with other partitions, or converted with incorrect start or  end
336              values. Use this feature with caution!
337
338
339       *      Booting  after converting an MBR or BSD disklabel disk is likely
340              to be disrupted. Sometimes re-installing a boot loader will  fix
341              the  problem,  but other times you may need to switch boot load‐
342              ers. Except on EFI-based platforms,  Windows  through  at  least
343              Windows 7 doesn't support booting from GPT disks. Creating a hy‐
344              brid MBR (using the 'h' option on the recovery &  transformation
345              menu  in  gdisk)  or  abandoning GPT in favor of MBR may be your
346              only options in this case.
347
348
349       *      The cgdisk Verify function and the partition  type  listing  ob‐
350              tainable  by typing L in the Type function (or when specifying a
351              partition type while creating a new  partition)  both  currently
352              exit  ncurses  mode. This limitation is a minor cosmetic blemish
353              that does not affect functionality.
354
355

AUTHORS

357       Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
358
359       Contributors:
360
361       * Yves Blusseau (1otnwmz02@sneakemail.com)
362
363       * David Hubbard (david.c.hubbard@gmail.com)
364
365       * Justin Maggard (justin.maggard@netgear.com)
366
367       * Dwight Schauer (das@teegra.net)
368
369       * Florian Zumbiehl (florz@florz.de)
370
371
372

SEE ALSO

374       cfdisk(8),   fdisk(8),   gdisk(8),   mkfs(8),   parted(8),   sfdisk(8),
375       sgdisk(8), fixparts(8).
376
377       http://en.wikipedia.org/wiki/GUID_Partition_Table
378
379       http://developer.apple.com/technotes/tn2006/tn2166.html
380
381       http://www.rodsbooks.com/gdisk/
382
383

AVAILABILITY

385       The  cgdisk  command  is part of the GPT fdisk package and is available
386       from Rod Smith.
387
388
389
390Roderick W. Smith                    1.0.9                           CGDISK(8)
Impressum