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.
183
184
185       Backup Save  partition data to a backup file. You can back up your cur‐
186              rent in-memory partition table to a disk file using this option.
187              The resulting file is a binary file consisting of the protective
188              MBR, the main GPT header, the backup GPT header, and one copy of
189              the  partition  table, in that order. Note that the backup is of
190              the current in-memory data structures, so if you launch the pro‐
191              gram,  make  changes,  and then use this option, the backup will
192              reflect your changes.
193
194
195       Delete Delete a partition. This action deletes the entry from the  par‐
196              tition  table  but  does not disturb the data within the sectors
197              originally allocated to the partition on the disk. If  a  corre‐
198              sponding hybrid MBR partition exists, gdisk deletes it, as well,
199              and expands any adjacent 0xEE (EFI GPT) MBR protective partition
200              to fill the new free space.
201
202
203       Help   Print brief descriptions of all the options.
204
205
206       Info   Show  detailed  partition  information.  The summary information
207              shown in the partition display area necessarily omits  many  de‐
208              tails,  such as the partitions' unique GUIDs and the partitions'
209              sector-exact start and end points. The Info option displays this
210              information for a single partition.
211
212
213       Load   Load  partition  data from a backup file. This option is the re‐
214              verse of the Backup option. Note that restoring  partition  data
215              from anything but the original disk is not recommended.
216
217
218       naMe   Change  the  GPT  name of a partition. This name is encoded as a
219              UTF-16 string, but proper entry and display of  anything  beyond
220              basic  ASCII  values  requires suitable locale and font support.
221              For the most part, Linux ignores the partition name, but it  may
222              be  important  in some OSes. GPT fdisk sets a default name based
223              on the partition type code. Note that the GPT partition name  is
224              different  from  the  filesystem  name,  which is encoded in the
225              filesystem's data structures. Note also that  to  activate  this
226              item  by  typing  its alphabetic equivalent, you must use M, not
227              the more obvious N, because the latter is used by the  next  op‐
228              tion....
229
230
231       New    Create  a  new partition. You enter a starting sector, a size, a
232              type code, and a name. The start sector can be specified in  ab‐
233              solute  terms  as  a  sector number or as a position measured in
234              kibibytes (K), mebibytes (M), gibibytes (G), tebibytes  (T),  or
235              pebibytes (P); for instance, 40M specifies a position 40MiB from
236              the start of the disk. You can specify locations relative to the
237              start  or  end  of  the specified default range by preceding the
238              number by a '+' symbol, as in +2G to specify a point 2GiB  after
239              the default start sector. The size value can use the K, M, G, T,
240              and P suffixes, too. Pressing the Enter key with no input speci‐
241              fies the default value, which is the start of the largest avail‐
242              able block for the start sector and the full available size  for
243              the size.
244
245
246       Quit   Quit from the program without saving your changes.  Use this op‐
247              tion if you just wanted to view information or  if  you  make  a
248              mistake and want to back out of all your changes.
249
250
251       Type   Change  a  single partition's type code. You enter the type code
252              using a two-byte hexadecimal number. You may also enter  a  GUID
253              directly,  if  you  have  one and cgdisk doesn't know it. If you
254              don't know the type code for your partition, you can type  L  to
255              see  a list of known type codes.  The type code list may option‐
256              ally be filtered by a  search  string;  for  instance,  entering
257              linux shows only partition type codes with descriptions that in‐
258              clude the string Linux. This search is  performed  case-insensi‐
259              tively.
260
261
262       Verify Verify  disk. This option checks for a variety of problems, such
263              as incorrect CRCs and mismatched main and backup data. This  op‐
264              tion  does  not automatically correct most problems, though; for
265              that, you must use gdisk. If no problems are found, this command
266              displays a summary of unallocated disk space.
267
268
269       Write  Write data. Use this command to save your changes.
270
271

BUGS

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

AUTHORS

350       Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
351
352       Contributors:
353
354       * Yves Blusseau (1otnwmz02@sneakemail.com)
355
356       * David Hubbard (david.c.hubbard@gmail.com)
357
358       * Justin Maggard (justin.maggard@netgear.com)
359
360       * Dwight Schauer (das@teegra.net)
361
362       * Florian Zumbiehl (florz@florz.de)
363
364
365

SEE ALSO

367       cfdisk(8),   fdisk(8),   gdisk(8),   mkfs(8),   parted(8),   sfdisk(8),
368       sgdisk(8), fixparts(8).
369
370       http://en.wikipedia.org/wiki/GUID_Partition_Table
371
372       http://developer.apple.com/technotes/tn2006/tn2166.html
373
374       http://www.rodsbooks.com/gdisk/
375
376

AVAILABILITY

378       The cgdisk command is part of the GPT fdisk package  and  is  available
379       from Rod Smith.
380
381
382
383Roderick W. Smith                    1.0.8                           CGDISK(8)
Impressum