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