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