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