File: cgdisk.html

package info (click to toggle)
gdisk 1.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 940 kB
  • sloc: cpp: 8,692; sh: 244; makefile: 48
file content (496 lines) | stat: -rw-r--r-- 18,510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
Content-type: text/html; charset=UTF-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CGDISK</TITLE>
</HEAD><BODY>
<H1>CGDISK</H1>
Section: GPT fdisk Manual (8)<BR>Updated: 1.0.5<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>

<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>

cgdisk - Curses-based GUID partition table (GPT) manipulator
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>cgdisk </B>

[ -a ]
<I>device</I>

<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

<P>
GPT fdisk is a text-mode family of programs for creation and manipulation
of partition tables. The <B>cgdisk</B> member of this family employs a
curses-based user interface for interaction using a text-mode menuing
system. It will automatically convert an old-style Master Boot Record
(MBR) partition table or BSD disklabel stored without an MBR carrier
partition to the newer Globally Unique Identifier (GUID) Partition Table
(GPT) format, or will load a GUID partition table. Other members of this
program family are <B>gdisk</B> (the most feature-rich program of the group,
with a non-curses-based interactive user interface) and <B>sgdisk</B> (which
is driven via command-line options for use by experts or in scripts).
FixParts is a related program for fixing a limited set of problems with MBR
disks.
<P>
For information on MBR vs. GPT, as well as GPT terminology and structure,
see the extended GPT fdisk documentation at
<I><A HREF="http://www.rodsbooks.com/gdisk/">http://www.rodsbooks.com/gdisk/</A></I> or consult Wikipedia.
<P>
The <B>cgdisk</B> program employs a user interface similar to that of Linux's
<B>cfdisk</B>, but <B>cgdisk</B> modifies GPT partitions. It also has the
capability of transforming MBR partitions or BSD disklabels into GPT
partitions. Like the original <B>cfdisk</B> program, <B>cgdisk</B> does not
modify disk structures until you explicitly write them to disk, so if you
make a mistake, you can exit from the program with the Quit option to leave
your partitions unmodified.
<P>
Ordinarily, <B>cgdisk</B> operates on disk device files, such as
<I>/dev/sda</I> or <I>/dev/hda</I> under Linux, <I>/dev/disk0</I> under
Mac OS X, or <I>/dev/ad0</I> or <I>/dev/da0</I> under FreeBSD. The program
can also operate on disk image files, which can be either copies of whole
disks (made with <B>dd</B>, for instance) or raw disk images used by
emulators such as QEMU or VMWare. Note that only <I>raw</I> disk images
are supported; <B>cgdisk</B> cannot work on compressed or other advanced
disk image formats.
<P>
Upon start, <B>cgdisk</B> attempts to identify the partition type in use on
the disk. If it finds valid GPT data, <B>cgdisk</B> will use it. If
<B>cgdisk</B> finds a valid MBR or BSD disklabel but no GPT data, it will
attempt to convert the MBR or disklabel into GPT form. (BSD disklabels are
likely to have unusable first and/or final partitions because they overlap
with the GPT data structures, though.) Upon exiting with the 'w' option,
<B>cgdisk</B> replaces the MBR or disklabel with a GPT. <I>This action is
potentially dangerous!</I> Your system may become unbootable, and partition
type codes may become corrupted if the disk uses unrecognized type codes.
Boot problems are particularly likely if you're multi-booting with any
GPT-unaware OS. If you mistakenly launch <B>cgdisk</B> on an MBR disk, you
can safely exit the program without making any changes by using the Quit
option.
<P>
When creating a fresh partition table, certain considerations may be in
order:
<P>
<DL COMPACT>
<DT><B>*</B>

<DD>
For data (non-boot) disks, and for boot disks used on BIOS-based computers
with GRUB as the boot loader, partitions may be created in whatever order
and in whatever sizes are desired.
<P>
<DT><B>*</B>

<DD>
Boot disks for EFI-based systems require an <I>EFI System
Partition</I> (GPT fdisk internal code 0xEF00) formatted as FAT-32.
The recommended size of this partition is between 100 and 300 MiB.
Boot-related files are stored here. (Note that GNU Parted identifies
such partitions as having the &quot;boot flag&quot; set.)
<P>
<DT><B>*</B>

<DD>
The GRUB 2 boot loader for BIOS-based systems makes use of a <I>BIOS Boot
Partition</I> (GPT fdisk internal code 0xEF02), in which the secondary
boot loader is stored, without the benefit of a filesystem. This partition
can typically be quite small (roughly 32 KiB to 1 MiB), but you should
consult your boot loader documentation for details.
<P>
<DT><B>*</B>

<DD>
If Windows is to boot from a GPT disk, a partition of type <I>Microsoft
Reserved</I> (GPT fdisk
internal code 0x0C01) is recommended. This partition should be about 128 MiB
in size. It ordinarily follows the EFI System Partition and immediately
precedes the Windows data partitions. (Note that old versions of GNU Parted
create all FAT partitions as this type, which actually makes the partition
unusable for normal file storage in both Windows and Mac OS X.)
<P>
<DT><B>*</B>

<DD>
Some OSes' GPT utilities create some blank space (typically 128 MiB) after
each partition. The intent is to enable future disk utilities to use this
space. Such free space is not required of GPT disks, but creating it may
help in future disk maintenance. You can use GPT fdisk's relative partition
positioning option (specifying the starting sector as '+128M', for
instance) to simplify creating such gaps.
<P>
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>

<P>
<P>

<P>
Only one command-line option is accepted, aside from the device filename:
<I>-a</I>. This option alters the highlighting of partitions and blocks of
free space: Instead of using ncurses, when <I>-a</I> is used <B>cgdisk</B>
uses a &quot;&gt;&quot; symbol to the left of the selected partition or free space.
This option is intended for use on limited display devices such as
teletypes and screen readers.
<P>
Interactions with <B>cgdisk</B> occur with its interactive text-mode menus.
The display is broken into two interactive parts:
<P>
<DL COMPACT>
<DT><B>*</B>

<DD>
The partition display area, in which partitions and gaps between them
(marked as &quot;free space&quot;) are summarized.
<P>
<DT><B>*</B>

<DD>
The option selection area, in which buttons for the main options appear.
<P>
</DL>
<P>

<P>
In addition, the top of the display shows the program's name and version
number, the device filename associated with the disk, and the disk's size
in both sectors and IEEE-1541 units (GiB, TiB, and so on).
<P>
You can use the following keys to move among the various options and to
select among them:
<P>
<DL COMPACT>
<DT><B>up arrow</B>

<DD>
This key moves the partition selection up by one partition.
<P>
<DT><B>down arrow</B>

<DD>
This key moves the partition selection down by one partition.
<P>
<DT><B>Page Up</B>

<DD>
This key moves the partition selection up by one screen.
<P>
<DT><B>Page Down</B>

<DD>
This key moves the partition selection down by one screen.
<P>
<DT><B>right arrow</B>

<DD>
This key moves the option selection to the right by one item.
<P>
<DT><B>left arrow</B>

<DD>
This key moves the option selection to the left by one item.
<P>
<DT><B>Enter</B>

<DD>
This key activates the currently selected option. You can also activate an
option by typing the capitalized letter in the option's name on the
keyboard, such as <B>a</B> to activate the Align option.
<P>
</DL>
<P>

<P>
If more partitions exist than can be displayed in one screen, you can
scroll between screens using the partition selection keys, much as in a
text editor.
<P>
Available options are as described below. (Note that <B>cgdisk</B> provides
a much more limited set of options than its sibling <B>gdisk</B>. If you
need to perform partition table recovery, hybrid MBR modifcation, or other
advanced operations, you should consult the <B>gdisk</B> documentation.)
<P>
<DL COMPACT>
<DT><B>Align</B>

<DD>
Change the sector alignment value. Disks with more logical sectors than
physical sectors (such as modern Advanced Format drives), some RAID
configurations, and many SSD devices, can suffer performance problems if
partitions are not aligned properly for their internal data structures. On
new disks, GPT fdisk attempts to align partitions on 1 MiB boundaries
(2048-sectors on disks with 512-byte sectors) by default, which optimizes
performance for all of these disk types. On pre-partitioned disks, GPT
fdisk attempts to identify the alignment value used on that disk, but will
set 8-sector alignment on disks larger than 300 GB even if lesser alignment
values are detected. In either case, it can be changed by using this
option.
<P>
<DT><B>Backup</B>

<DD>
Save partition data to a backup file. You can back up your current
in-memory partition table to a disk file using this option. The resulting
file is a binary file consisting of the protective MBR, the main GPT
header, the backup GPT header, and one copy of the partition table, in that
order. Note that the backup is of the current in-memory data structures, so
if you launch the program, make changes, and then use this option, the
backup will reflect your changes.
<P>
<DT><B>Delete</B>

<DD>
Delete a partition. This action deletes the entry from the partition table
but does not disturb the data within the sectors originally allocated to
the partition on the disk. If a corresponding hybrid MBR partition exists,
<B>gdisk</B> deletes it, as well, and expands any adjacent 0xEE (EFI GPT)
MBR protective partition to fill the new free space.
<P>
<DT><B>Help</B>

<DD>
Print brief descriptions of all the options.
<P>
<DT><B>Info</B>

<DD>
Show detailed partition information. The summary information shown in the
partition display area necessarily omits many details, such as the
partitions' unique GUIDs and the partitions' sector-exact start and end
points. The Info option displays this information for a single partition.
<P>
<DT><B>Load</B>

<DD>
Load partition data from a backup file. This option is the reverse of the
Backup option. Note that restoring partition data from anything but the
original disk is not recommended.
<P>
<DT><B>naMe</B>

<DD>
Change the GPT name of a partition. This name is encoded as a UTF-16
string, but proper entry and display of anything beyond basic ASCII values
requires suitable locale and font support. For the most part, Linux ignores
the partition name, but it may be important in some OSes. GPT fdisk sets a
default name based on the partition type code. Note that the GPT partition
name is different from the filesystem name, which is encoded in the
filesystem's data structures. Note also that to activate this item by
typing its alphabetic equivalent, you must use <B>M</B>, not the more
obvious <B>N</B>, because the latter is used by the next option....
<P>
<DT><B>New</B>

<DD>
Create a new partition. You enter a starting sector, a size, a type code,
and a name. The start sector can be specified in absolute terms as a sector
number or as a position measured in kibibytes (K), mebibytes (M), gibibytes
(G), tebibytes (T), or pebibytes (P); for instance, <I></I><B>40M</B>
specifies a position 40MiB from the start of the disk. You can specify
locations relative to the start or end of the specified default range by
preceding the number by a '+' symbol, as in <I></I><B>+2G</B> to specify a
point 2GiB after the default start sector. The size value can use the K, M,
G, T, and P suffixes, too. Pressing the Enter key with no input specifies
the default value, which is the start of the largest available block for
the start sector and the full available size for the size.
<P>
<DT><B>Quit</B>

<DD>
Quit from the program <I>without saving your changes</I>.
Use this option if you just wanted to view information or if you make a
mistake and want to back out of all your changes.
<P>
<DT><B>Type</B>

<DD>
Change a single partition's type code. You enter the type code using a
two-byte hexadecimal number. You may also enter a GUID directly, if you
have one and <B>cgdisk</B> doesn't know it. If you don't know the type code
for your partition, you can type <B>L</B> to see a list of known type codes.
The type code list may optionally be filtered by a search string; for
instance, entering <I></I><B>linux</B> shows only partition type codes with
descriptions that include the string <I>Linux</I>. This search is performed
case-insensitively.
<P>
<DT><B>Verify</B>

<DD>
Verify disk. This option checks for a variety of problems, such as
incorrect CRCs and mismatched main and backup data. This option does not
automatically correct most problems, though; for that, you must use
<B>gdisk</B>. If no problems are found, this command displays a summary of
unallocated disk space.
<P>
<DT><B>Write</B>

<DD>
Write data. Use this command to save your changes.
<P>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>BUGS</H2>

<P>
Known bugs and limitations include:
<P>
<DL COMPACT>
<DT><B>*</B>

<DD>
The program compiles correctly only on Linux, FreeBSD, and Mac OS X. In
theory, it should compile under Windows if the Ncurses library for Windows
is installed, but I have not tested this capability. Linux versions for
x86-64 (64-bit), x86 (32-bit), and PowerPC (32-bit) have been tested,
with the x86-64 version having seen the most testing. Under FreeBSD,
32-bit (x86) and 64-bit (x86-64) versions have been tested. Only 32-bit
versions for Mac OS X has been tested by the author.
<P>
<DT><B>*</B>

<DD>
The FreeBSD version of the program can't write changes to the partition
table to a disk when existing partitions on that disk are mounted. (The
same problem exists with many other FreeBSD utilities, such as
<B>gpt</B>, <B>fdisk</B>, and <B>dd</B>.) This limitation can be overcome
by typing <B>sysctl kern.geom.debugflags=16</B> at a shell prompt.
<P>
<DT><B>*</B>

<DD>
The program can load only up to 128 partitions (4 primary partitions and
124 logical partitions) when converting from MBR format. This limit can
be raised by changing the <I>#define MAX_MBR_PARTS</I> line in the
<I>basicmbr.h</I> source code file and recompiling; however, such a change
will require using a larger-than-normal partition table. (The limit
of 128 partitions was chosen because that number equals the 128 partitions
supported by the most common partition table size.)
<P>
<DT><B>*</B>

<DD>
Converting from MBR format sometimes fails because of insufficient space at
the start or (more commonly) the end of the disk. Resizing the partition
table (using the 's' option in the experts' menu in <B>gdisk</B>) can
sometimes overcome this problem; however, in extreme cases it may be
necessary to resize a partition using GNU Parted or a similar tool prior to
conversion with GPT fdisk.
<P>
<DT><B>*</B>

<DD>
MBR conversions work only if the disk has correct LBA partition
descriptors. These descriptors should be present on any disk over 8 GiB in
size or on smaller disks partitioned with any but very ancient software.
<P>
<DT><B>*</B>

<DD>
BSD disklabel support can create first and/or last partitions that overlap
with the GPT data structures. This can sometimes be compensated by
adjusting the partition table size, but in extreme cases the affected
partition(s) may need to be deleted.
<P>
<DT><B>*</B>

<DD>
Because of the highly variable nature of BSD disklabel structures,
conversions from this form may be unreliable -- partitions may be dropped,
converted in a way that creates overlaps with other partitions, or
converted with incorrect start or end values. Use this feature with
caution!
<P>
<DT><B>*</B>

<DD>
Booting after converting an MBR or BSD disklabel disk is likely to be
disrupted. Sometimes re-installing a boot loader will fix the problem, but
other times you may need to switch boot loaders. Except on EFI-based
platforms, Windows through at least Windows 7 doesn't support booting from
GPT disks. Creating a hybrid MBR (using the 'h' option on the recovery &amp;
transformation menu in <B>gdisk</B>) or abandoning GPT in favor of MBR may
be your only options in this case.
<P>
<DT><B>*</B>

<DD>
The <B>cgdisk</B> Verify function and the partition type listing obtainable
by typing <I>L</I> in the Type function (or when specifying a partition type
while creating a new partition) both currently exit ncurses mode. This
limitation is a minor cosmetic blemish that does not affect functionality.
<P>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHORS</H2>

Primary author: Roderick W. Smith (<A HREF="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</A>)
<P>
Contributors:
<P>
* Yves Blusseau (<A HREF="mailto:1otnwmz02@sneakemail.com">1otnwmz02@sneakemail.com</A>)
<P>
* David Hubbard (<A HREF="mailto:david.c.hubbard@gmail.com">david.c.hubbard@gmail.com</A>)
<P>
* Justin Maggard (<A HREF="mailto:justin.maggard@netgear.com">justin.maggard@netgear.com</A>)
<P>
* Dwight Schauer (<A HREF="mailto:dschauer@gmail.com">dschauer@gmail.com</A>)
<P>
* Florian Zumbiehl (<A HREF="mailto:florz@florz.de">florz@florz.de</A>)
<P>
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>

<B><A HREF="/cgi-bin/man/man2html?8+cfdisk">cfdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+fdisk">fdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+gdisk">gdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+mkfs">mkfs</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+parted">parted</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+sfdisk">sfdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+sgdisk">sgdisk</A></B>(8),

<B><A HREF="/cgi-bin/man/man2html?8+fixparts">fixparts</A></B>(8).

<P>
<I><A HREF="http://en.wikipedia.org/wiki/GUID_Partition_Table">http://en.wikipedia.org/wiki/GUID_Partition_Table</A></I>
<P>
<I><A HREF="http://developer.apple.com/technotes/tn2006/tn2166.html">http://developer.apple.com/technotes/tn2006/tn2166.html</A></I>
<P>
<I><A HREF="http://www.rodsbooks.com/gdisk/">http://www.rodsbooks.com/gdisk/</A></I>
<P>
<A NAME="lbAI">&nbsp;</A>
<H2>AVAILABILITY</H2>

The <B>cgdisk</B> command is part of the <I>GPT fdisk</I> package and is
available from Rod Smith.
<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">OPTIONS</A><DD>
<DT><A HREF="#lbAF">BUGS</A><DD>
<DT><A HREF="#lbAG">AUTHORS</A><DD>
<DT><A HREF="#lbAH">SEE ALSO</A><DD>
<DT><A HREF="#lbAI">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 22:34:11 GMT, February 17, 2020
</BODY>
</HTML>