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

NAME

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

SYNOPSIS

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

BUGS

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

AUTHORS

342       Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
343
344       Contributors:
345
346       * Yves Blusseau (1otnwmz02@sneakemail.com)
347
348       * David Hubbard (david.c.hubbard@gmail.com)
349
350       * Justin Maggard (justin.maggard@netgear.com)
351
352       * Dwight Schauer (dschauer@ti.com)
353
354       * Florian Zumbiehl (florz@florz.de)
355
356
357

SEE ALSO

359       cfdisk  (8),  fdisk  (8),  gdisk  (8), mkfs (8), parted (8), sfdisk (8)
360       sgdisk (8) fixparts (8)
361
362       http://en.wikipedia.org/wiki/GUID_Partition_Table
363
364       http://developer.apple.com/technotes/tn2006/tn2166.html
365
366       http://www.rodsbooks.com/gdisk/
367
368

AVAILABILITY

370       The cgdisk command is part of the GPT fdisk package  and  is  available
371       from Rod Smith.
372
373
374
375Roderick W. Smith                    0.8.1                           CGDISK(8)
Impressum