1CGDISK(8) GPT fdisk Manual CGDISK(8)
2
3
4
6 cgdisk - Curses-based GUID partition table (GPT) manipulator
7
9 cgdisk [ -a ] device
10
11
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
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
157 option's name on the keyboard, such as a to activate the Align
158 option.
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 modifcation, or other
168 advanced 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 2048-sector (1MiB) boundaries by
177 default, which optimizes performance for all of these disk
178 types. On pre-partitioned disks, GPT fdisk attempts to identify
179 the alignment value used on that disk, but will set 8-sector
180 alignment on disks larger than 300 GB even if lesser alignment
181 values are detected. In either case, it can be changed by using
182 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
208 details, such as the partitions' unique GUIDs and the parti‐
209 tions' sector-exact start and end points. The Info option dis‐
210 plays this information for a single partition.
211
212
213 Load Load partition data from a backup file. This option is the
214 reverse 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
228 option....
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
233 absolute 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
247 option 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.
256
257
258 Verify Verify disk. This option checks for a variety of problems, such
259 as incorrect CRCs and mismatched main and backup data. This
260 option does not automatically correct most problems, though; for
261 that, you must use gdisk. If no problems are found, this command
262 displays a summary of unallocated disk space.
263
264
265 Write Write data. Use this command to save your changes.
266
267
269 As of March 2014 (version 0.8.10), cgdisk should be considered beta
270 software. Although the underlying partition manipulation code is much
271 older, the cgdisk ncurses user interface is brand new with GPT fdisk
272 version 0.8.0. Known bugs and limitations include:
273
274
275 * The program compiles correctly only on Linux, FreeBSD, and Mac
276 OS X. In theory, it should compile under Windows if the Ncurses
277 library for Windows is installed, but I have not tested this
278 capability. Linux versions for x86-64 (64-bit), x86 (32-bit),
279 and PowerPC (32-bit) have been tested, with the x86-64 version
280 having seen the most testing. Under FreeBSD, 32-bit (x86) and
281 64-bit (x86-64) versions have been tested. Only 32-bit versions
282 for Mac OS X has been tested by the author.
283
284
285 * The FreeBSD version of the program can't write changes to the
286 partition table to a disk when existing partitions on that disk
287 are mounted. (The same problem exists with many other FreeBSD
288 utilities, such as gpt, fdisk, and dd.) This limitation can be
289 overcome by typing sysctl kern.geom.debugflags=16 at a shell
290 prompt.
291
292
293 * The program can load only up to 128 partitions (4 primary parti‐
294 tions and 124 logical partitions) when converting from MBR for‐
295 mat. This limit can be raised by changing the #define
296 MAX_MBR_PARTS line in the basicmbr.h source code file and recom‐
297 piling; however, such a change will require using a
298 larger-than-normal partition table. (The limit of 128 partitions
299 was chosen because that number equals the 128 partitions sup‐
300 ported by the most common partition table size.)
301
302
303 * Converting from MBR format sometimes fails because of insuffi‐
304 cient space at the start or (more commonly) the end of the disk.
305 Resizing the partition table (using the 's' option in the
306 experts' menu in gdisk) can sometimes overcome this problem;
307 however, in extreme cases it may be necessary to resize a parti‐
308 tion using GNU Parted or a similar tool prior to conversion with
309 GPT fdisk.
310
311
312 * MBR conversions work only if the disk has correct LBA partition
313 descriptors. These descriptors should be present on any disk
314 over 8 GiB in size or on smaller disks partitioned with any but
315 very ancient software.
316
317
318 * BSD disklabel support can create first and/or last partitions
319 that overlap with the GPT data structures. This can sometimes be
320 compensated by adjusting the partition table size, but in
321 extreme cases the affected partition(s) may need to be deleted.
322
323
324 * Because of the highly variable nature of BSD disklabel struc‐
325 tures, conversions from this form may be unreliable -- parti‐
326 tions may be dropped, converted in a way that creates overlaps
327 with other partitions, or converted with incorrect start or end
328 values. Use this feature with caution!
329
330
331 * Booting after converting an MBR or BSD disklabel disk is likely
332 to be disrupted. Sometimes re-installing a boot loader will fix
333 the problem, but other times you may need to switch boot load‐
334 ers. Except on EFI-based platforms, Windows through at least
335 Windows 7 doesn't support booting from GPT disks. Creating a
336 hybrid MBR (using the 'h' option on the recovery & transforma‐
337 tion menu in gdisk) or abandoning GPT in favor of MBR may be
338 your only options in this case.
339
340
341 * The cgdisk Verify function and the partition type listing
342 obtainable by typing L in the Type function (or when specifying
343 a partition type while creating a new partition) both currently
344 exit ncurses mode. This limitation is a minor cosmetic blemish
345 that does not affect functionality.
346
347
349 Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
350
351 Contributors:
352
353 * Yves Blusseau (1otnwmz02@sneakemail.com)
354
355 * David Hubbard (david.c.hubbard@gmail.com)
356
357 * Justin Maggard (justin.maggard@netgear.com)
358
359 * Dwight Schauer (dschauer@ti.com)
360
361 * Florian Zumbiehl (florz@florz.de)
362
363
364
366 cfdisk (8), fdisk (8), gdisk (8), mkfs (8), parted (8), sfdisk (8)
367 sgdisk (8) fixparts (8)
368
369 http://en.wikipedia.org/wiki/GUID_Partition_Table
370
371 http://developer.apple.com/technotes/tn2006/tn2166.html
372
373 http://www.rodsbooks.com/gdisk/
374
375
377 The cgdisk command is part of the GPT fdisk package and is available
378 from Rod Smith.
379
380
381
382Roderick W. Smith 0.8.10 CGDISK(8)