blob: 66655d314942d874f860ead92d86f15a3c8a4208 [file] [log] [blame]
srs56940741fa22013-01-09 12:55:40 -05001.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com)
srs56943860cbe2011-09-10 20:29:53 -04002.\" May be distributed under the GNU General Public License
srs56940741fa22013-01-09 12:55:40 -05003.TH "CGDISK" "8" "0.8.6" "Roderick W. Smith" "GPT fdisk Manual"
srs56943860cbe2011-09-10 20:29:53 -04004.SH "NAME"
5cgdisk \- Curses-based GUID partition table (GPT) manipulator
6.SH "SYNOPSIS"
7.BI "cgdisk "
8.I device
9
10.SH "DESCRIPTION"
11
12GPT fdisk is a text\-mode family of programs for creation and manipulation
13of partition tables. The \fBcgdisk\fR member of this family employs a
14curses-based user interface for interaction using a text\-mode menuing
15system. It will automatically convert an old\-style Master Boot Record
16(MBR) partition table or BSD disklabel stored without an MBR carrier
17partition to the newer Globally Unique Identifier (GUID) Partition Table
18(GPT) format, or will load a GUID partition table. Other members of this
19program family are \fBgdisk\fR (the most feature-rich program of the group,
20with a non-curses-based interactive user interface) and \fBsgdisk\fR (which
21is driven via command-line options for use by experts or in scripts).
22FixParts is a related program for fixing a limited set of problems with MBR
23disks.
24
25For information on MBR vs. GPT, as well as GPT terminology and structure,
26see the extended GPT fdisk documentation at
27\fIhttp://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
28
29The \fBcgdisk\fR program employs a user interface similar to that of Linux's
30\fBcfdisk\fR, but \fBcgdisk\fR modifies GPT partitions. It also has the
31capability of transforming MBR partitions or BSD disklabels into GPT
32partitions. Like the original \fBcfdisk\fR program, \fBcgdisk\fR does not
33modify disk structures until you explicitly write them to disk, so if you
34make a mistake, you can exit from the program with the Quit option to leave
35your partitions unmodified.
36
37Ordinarily, \fBcgdisk\fR operates on disk device files, such as
38\fI/dev/sda\fR or \fI/dev/hda\fR under Linux, \fI/dev/disk0\fR under
39Mac OS X, or \fI/dev/ad0\fR or \fI/dev/da0\fR under FreeBSD. The program
40can also operate on disk image files, which can be either copies of whole
41disks (made with \fBdd\fR, for instance) or raw disk images used by
42emulators such as QEMU or VMWare. Note that only \fIraw\fR disk images
43are supported; \fBcgdisk\fR cannot work on compressed or other advanced
44disk image formats.
45
46Upon start, \fBcgdisk\fR attempts to identify the partition type in use on
47the disk. If it finds valid GPT data, \fBcgdisk\fR will use it. If
48\fBcgdisk\fR finds a valid MBR or BSD disklabel but no GPT data, it will
49attempt to convert the MBR or disklabel into GPT form. (BSD disklabels are
50likely to have unusable first and/or final partitions because they overlap
51with the GPT data structures, though.) Upon exiting with the 'w' option,
52\fBcgdisk\fR replaces the MBR or disklabel with a GPT. \fIThis action is
53potentially dangerous!\fR Your system may become unbootable, and partition
54type codes may become corrupted if the disk uses unrecognized type codes.
55Boot problems are particularly likely if you're multi\-booting with any
56GPT\-unaware OS. If you mistakenly launch \fBcgdisk\fR on an MBR disk, you
57can safely exit the program without making any changes by using the Quit
58option.
59
60When creating a fresh partition table, certain considerations may be in
61order:
62
63.TP
64.B *
65For data (non\-boot) disks, and for boot disks used on BIOS\-based computers
66with GRUB as the boot loader, partitions may be created in whatever order
67and in whatever sizes are desired.
68
69.TP
70.B *
71Boot disks for EFI\-based systems require an \fIEFI System
72Partition\fR (GPT fdisk internal code 0xEF00) formatted as FAT\-32.
73The recommended size of this partition is between 100 and 300 MiB.
74Boot\-related files are stored here. (Note that GNU Parted identifies
75such partitions as having the "boot flag" set.)
76
77.TP
78.B *
79The GRUB 2 boot loader for BIOS\-based systems makes use of a \fIBIOS Boot
80Partition\fR (GPT fdisk internal code 0xEF02), in which the secondary
81boot loader is stored, without the benefit of a filesystem. This partition
82can typically be quite small (roughly 32 KiB to 1 MiB), but you should
83consult your boot loader documentation for details.
84
85.TP
86.B *
87If Windows is to boot from a GPT disk, a partition of type \fIMicrosoft
88Reserved\fR (GPT fdisk
89internal code 0x0C01) is recommended. This partition should be about 128 MiB
90in size. It ordinarily follows the EFI System Partition and immediately
91precedes the Windows data partitions. (Note that old versions of GNU Parted
92create all FAT partitions as this type, which actually makes the partition
93unusable for normal file storage in both Windows and Mac OS X.)
94
95.TP
96.B *
97Some OSes' GPT utilities create some blank space (typically 128 MiB) after
98each partition. The intent is to enable future disk utilities to use this
99space. Such free space is not required of GPT disks, but creating it may
100help in future disk maintenance. You can use GPT fdisk's relative partition
101positioning option (specifying the starting sector as '+128M', for
102instance) to simplify creating such gaps.
103
104.SH "OPTIONS"
105
106.PP
107
108Interactions with \fBcgdisk\fR occur with its interactive text\-mode menus.
109The display is broken into two interactive parts:
110
111.TP
112.B *
113The partition display area, in which partitions and gaps between them
114(marked as "free space") are summarized.
115
116.TP
117.B *
118The option selection area, in which buttons for the main options appear.
119
120.PP
121
122In addition, the top of the display shows the program's name and version
123number, the device filename associated with the disk, and the disk's size
124in both sectors and IEEE-1541 units (GiB, TiB, and so on).
125
126You can use the following keys to move among the various options and to
127select among them:
128
129.TP
130.B up arrow
131This key moves the partition selection up by one partition.
132
133.TP
134.B down arrow
135This key moves the partition selection down by one partition.
136
137.TP
138.B Page Up
139This key moves the partition selection up by one screen.
140
141.TP
142.B Page Down
143This key moves the partition selection down by one screen.
144
145.TP
146.B right arrow
147This key moves the option selection to the right by one item.
148
149.TP
150.B left arrow
151This key moves the option selection to the left by one item.
152
153.TP
154.B Enter
155This key activates the currently selected option. You can also activate an
156option by typing the capitalized letter in the option's name on the
157keyboard, such as \fBa\fR to activate the Align option.
158
159.PP
160
161If more partitions exist than can be displayed in one screen, you can
162scroll between screens using the partition selection keys, much as in a
163text editor.
164
165Available options are as described below. (Note that \fBcgdisk\fR provides
166a much more limited set of options than its sibling \fBgdisk\fR. If you
167need to perform partition table recovery, hybrid MBR modifcation, or other
168advanced operations, you should consult the \fBgdisk\fR documentation.)
169
170.TP
171.B Align
172Change the sector alignment value. Disks with more logical sectors than
173physical sectors (such as modern Advanced Format drives), some RAID
174configurations, and many SSD devices, can suffer performance problems if
175partitions are not aligned properly for their internal data structures. On
176new disks, GPT fdisk attempts to align partitions on 2048\-sector (1MiB)
177boundaries by default, which optimizes performance for all of these disk
178types. On pre\-partitioned disks, GPT fdisk attempts to identify the
179alignment value used on that disk, but will set 8-sector alignment on disks
180larger than 300 GB even if lesser alignment values are detected. In either
181case, it can be changed by using this option.
182
183.TP
184.B Backup
185Save partition data to a backup file. You can back up your current
186in\-memory partition table to a disk file using this option. The resulting
187file is a binary file consisting of the protective MBR, the main GPT
188header, the backup GPT header, and one copy of the partition table, in that
189order. Note that the backup is of the current in\-memory data structures, so
190if you launch the program, make changes, and then use this option, the
191backup will reflect your changes.
192
193.TP
194.B Delete
195Delete a partition. This action deletes the entry from the partition table
196but does not disturb the data within the sectors originally allocated to
197the partition on the disk. If a corresponding hybrid MBR partition exists,
198\fBgdisk\fR deletes it, as well, and expands any adjacent 0xEE (EFI GPT)
199MBR protective partition to fill the new free space.
200
201.TP
202.B Help
203Print brief descriptions of all the options.
204
205.TP
206.B Info
207Show detailed partition information. The summary information shown in the
208partition display area necessarily omits many details, such as the
209partitions' unique GUIDs and the partitions' sector-exact start and end
210points. The Info option displays this information for a single partition.
211
212.TP
213.B Load
214Load partition data from a backup file. This option is the reverse of the
215Backup option. Note that restoring partition data from anything but the
216original disk is not recommended.
217
218.TP
219.B naMe
220Change the GPT name of a partition. This name is encoded as a UTF\-16
221string, but proper entry and display of anything beyond basic ASCII values
222requires suitable locale and font support. For the most part, Linux ignores
223the partition name, but it may be important in some OSes. GPT fdisk sets a
224default name based on the partition type code. Note that the GPT partition
225name is different from the filesystem name, which is encoded in the
226filesystem's data structures. Note also that to activate this item by
227typing its alphabetic equivalent, you must use \fBM\fR, not the more
228obvious \fBN\fR, because the latter is used by the next option....
229
230.TP
231.B New
232Create a new partition. You enter a starting sector, a size, a type code,
233and a name. The start sector can be specified in absolute terms as a sector
234number or as a position measured in kibibytes (K), mebibytes (M), gibibytes
235(G), tebibytes (T), or pebibytes (P); for instance, \fI\fB40M\fR\fR
236specifies a position 40MiB from the start of the disk. You can specify
237locations relative to the start or end of the specified default range by
238preceding the number by a '+' symbol, as in \fI\fB+2G\fR\fR to specify a
239point 2GiB after the default start sector. The size value can use the K, M,
240G, T, and P suffixes, too. Pressing the Enter key with no input specifies
241the default value, which is the start of the largest available block for
242the start sector and the full available size for the size.
243
244.TP
245.B Quit
246Quit from the program \fIwithout saving your changes\fR.
247Use this option if you just wanted to view information or if you make a
248mistake and want to back out of all your changes.
249
250.TP
251.B Type
252Change a single partition's type code. You enter the type code using a
253two\-byte hexadecimal number. You may also enter a GUID directly, if you
254have one and \fBcgdisk\fR doesn't know it. If you don't know the type code
255for your partition, you can type \fBL\fR to see a list of known type codes.
256
257.TP
258.B Verify
259Verify disk. This option checks for a variety of problems, such as
260incorrect CRCs and mismatched main and backup data. This option does not
261automatically correct most problems, though; for that, you must use
262\fBgdisk\fR. If no problems are found, this command displays a summary of
263unallocated disk space.
264
265.TP
266.B Write
267Write data. Use this command to save your changes.
268
269.SH "BUGS"
270
srs56940741fa22013-01-09 12:55:40 -0500271As of January 2013 (version 0.8.6), \fBcgdisk\fR should be considered
srs56943860cbe2011-09-10 20:29:53 -0400272beta software. Although the underlying partition manipulation code is much
273older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk
274version 0.8.0. Known bugs and limitations include:
275
276.TP
277.B *
278The program compiles correctly only on Linux, FreeBSD, and Mac OS X. In
279theory, it should compile under Windows if the Ncurses library for Windows
280is installed, but I have not tested this capability. Linux versions for
281x86\-64 (64\-bit), x86 (32\-bit), and PowerPC (32\-bit) have been tested,
282with the x86\-64 version having seen the most testing. Under FreeBSD,
28332\-bit (x86) and 64\-bit (x86\-64) versions have been tested. Only 32\-bit
284versions for Mac OS X has been tested by the author.
285
286.TP
287.B *
288The FreeBSD version of the program can't write changes to the partition
289table to a disk when existing partitions on that disk are mounted. (The
290same problem exists with many other FreeBSD utilities, such as
291\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.) This limitation can be overcome
292by typing \fBsysctl kern.geom.debugflags=16\fR at a shell prompt.
293
294.TP
295.B *
296The program can load only up to 128 partitions (4 primary partitions and
297124 logical partitions) when converting from MBR format. This limit can
298be raised by changing the \fI#define MAX_MBR_PARTS\fR line in the
299\fIbasicmbr.h\fR source code file and recompiling; however, such a change
300will require using a larger\-than\-normal partition table. (The limit
301of 128 partitions was chosen because that number equals the 128 partitions
302supported by the most common partition table size.)
303
304.TP
305.B *
306Converting from MBR format sometimes fails because of insufficient space at
307the start or (more commonly) the end of the disk. Resizing the partition
308table (using the 's' option in the experts' menu in \fBgdisk\fR) can
309sometimes overcome this problem; however, in extreme cases it may be
310necessary to resize a partition using GNU Parted or a similar tool prior to
311conversion with GPT fdisk.
312
313.TP
314.B *
315MBR conversions work only if the disk has correct LBA partition
316descriptors. These descriptors should be present on any disk over 8 GiB in
317size or on smaller disks partitioned with any but very ancient software.
318
319.TP
320.B *
321BSD disklabel support can create first and/or last partitions that overlap
322with the GPT data structures. This can sometimes be compensated by
323adjusting the partition table size, but in extreme cases the affected
324partition(s) may need to be deleted.
325
326.TP
327.B *
328Because of the highly variable nature of BSD disklabel structures,
329conversions from this form may be unreliable \-\- partitions may be dropped,
330converted in a way that creates overlaps with other partitions, or
331converted with incorrect start or end values. Use this feature with
332caution!
333
334.TP
335.B *
336Booting after converting an MBR or BSD disklabel disk is likely to be
337disrupted. Sometimes re\-installing a boot loader will fix the problem, but
338other times you may need to switch boot loaders. Except on EFI\-based
339platforms, Windows through at least Windows 7 doesn't support booting from
340GPT disks. Creating a hybrid MBR (using the 'h' option on the recovery &
341transformation menu in \fBgdisk\fR) or abandoning GPT in favor of MBR may
342be your only options in this case.
343
344.TP
345.B *
346The \fBcgdisk\fR Verify function and the partition type listing obtainable
347by typing \fIL\fR in the Type function (or when specifying a partition type
348while creating a new partition) both currently exit ncurses mode. This
349limitation is a minor cosmetic blemish that does not affect functionality.
350
351.SH "AUTHORS"
352Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
353
354Contributors:
355
356* Yves Blusseau (1otnwmz02@sneakemail.com)
357
358* David Hubbard (david.c.hubbard@gmail.com)
359
360* Justin Maggard (justin.maggard@netgear.com)
361
362* Dwight Schauer (dschauer@ti.com)
363
364* Florian Zumbiehl (florz@florz.de)
365
366
367.SH "SEE ALSO"
368\fBcfdisk (8)\fR,
369\fBfdisk (8)\fR,
370\fBgdisk (8)\fR,
371\fBmkfs (8)\fR,
372\fBparted (8)\fR,
373\fBsfdisk (8)\fR
374\fBsgdisk (8)\fR
375\fBfixparts (8)\fR
376
377\fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR
378
379\fIhttp://developer.apple.com/technotes/tn2006/tn2166.html\fR
380
381\fIhttp://www.rodsbooks.com/gdisk/\fR
382
383.SH "AVAILABILITY"
384The \fBcgdisk\fR command is part of the \fIGPT fdisk\fR package and is
385available from Rod Smith.