blob: c83c0daec94d0d8bbbb432822596bb473c90b274 [file] [log] [blame]
srs5694e7b4ff92009-08-18 13:16:10 -04001.\" Copyright 2009 Roderick W. Smith (rodsmith@rodsbooks.com)
2.\" May be distributed under the GNU General Public License
srs569408bb0da2010-02-19 17:19:55 -05003.TH "GDISK" "8" "0.6.4" "Roderick W. Smith" "GPT fdisk Manual"
srs5694978041c2009-09-21 20:51:47 -04004.SH "NAME"
srs56940a697312010-01-28 21:10:52 -05005gdisk \- Interactive GUID partition table (GPT) manipulator
srs5694978041c2009-09-21 20:51:47 -04006.SH "SYNOPSIS"
srs5694e7b4ff92009-08-18 13:16:10 -04007.BI "gdisk "
8[ \-l ]
9.I device
srs5694221e0872009-08-29 15:00:31 -040010
srs5694978041c2009-09-21 20:51:47 -040011.SH "DESCRIPTION"
srs5694221e0872009-08-29 15:00:31 -040012
srs5694978041c2009-09-21 20:51:47 -040013GPT fdisk (aka \fBgdisk\fR) is a text\-mode menu\-driven program for
14creation and manipulation of partition tables. It will automatically
15convert an old\-style Master Boot Record (MBR) partition table or BSD
16disklabel stored without an MBR carrier partition to the newer Globally
srs56948bb78762009-11-24 15:43:49 -050017Unique Identifier (GUID) Partition Table (GPT) format, or will load a GUID
srs5694978041c2009-09-21 20:51:47 -040018partition table. When used with the \fI\-l\fR command\-line option, the
19program displays the current partition table and then exits.
srs5694e7b4ff92009-08-18 13:16:10 -040020
srs5694978041c2009-09-21 20:51:47 -040021GPT fdisk operates mainly on the GPT headers and partition tables; however,
srs5694e7b4ff92009-08-18 13:16:10 -040022it can and will generate a fresh protective MBR, when required. (Any boot
23loader code in the protective MBR will not be disturbed.) If you've created
24an unusual protective MBR, such as a hybrid MBR created by
srs5694978041c2009-09-21 20:51:47 -040025\fBgptsync\fR or \fBgdisk\fR's own hybrid MBR creation feature,
srs5694e7b4ff92009-08-18 13:16:10 -040026this should not be disturbed by most ordinary actions. Some advanced data
27recovery options require you to understand the distinctions between the
28main and backup data, as well as between the GPT headers and the partition
srs5694978041c2009-09-21 20:51:47 -040029tables. For information on MBR vs. GPT, as well as GPT terminology and
30structure, see the extended \fBgdisk\fR documentation at
31\fIhttp://www.rodsbooks.com/gdisk/\fR or consult Wikipedia.
srs5694e7b4ff92009-08-18 13:16:10 -040032
srs5694978041c2009-09-21 20:51:47 -040033The \fBgdisk\fR program employs a user interface similar to that of Linux's
srs56948bb78762009-11-24 15:43:49 -050034\fBfdisk\fR, but \fBgdisk\fR modifies GPT partitions. It also has the
35capability of transforming MBR partitions or BSD disklabels into GPT
36partitions. Like the original \fBfdisk\fR program, \fBgdisk\fR does not
37modify disk structures until you explicitly write them to disk, so if you
38make a mistake, you can exit from the program with the 'q' option to save
39your partitions.
srs5694e7b4ff92009-08-18 13:16:10 -040040
srs5694978041c2009-09-21 20:51:47 -040041Ordinarily, \fBgdisk\fR operates on disk device files, such as
42\fI/dev/sda\fR or \fI/dev/hda\fR under Linux, \fI/dev/disk0\fR under
43Mac OS X, or \fI/dev/ad0\fR or \fI/dev/da0\fR under FreeBSD. The program
44can also operate on disk image files, which can be either copies of whole
45disks (made with \fBdd\fR, for instance) or raw disk images used by
46emulators such as QEMU or VMWare. Note that only \fIraw\fR disk images
47are supported; \fBgdisk\fR cannot work on compressed or other advanced
48disk image formats.
srs5694e7b4ff92009-08-18 13:16:10 -040049
50The MBR partitioning system uses a combination of cylinder/head/sector
51(CHS) addressing and logical block addressing (LBA). The former is klunky
srs5694978041c2009-09-21 20:51:47 -040052and limiting. GPT drops CHS addressing and uses 64\-bit LBA mode
srs5694e7b4ff92009-08-18 13:16:10 -040053exclusively. Thus, GPT data structures, and therefore
srs5694978041c2009-09-21 20:51:47 -040054\fBgdisk\fR, do not need to deal with CHS geometries and all the problems
55they create. Users of \fBfdisk\fR will note that \fBgdisk\fR
srs5694e7b4ff92009-08-18 13:16:10 -040056lacks the options and limitations associated with CHS geometries.
57
srs5694978041c2009-09-21 20:51:47 -040058For best results, you should use an OS\-specific partition table
59program whenever possible. For example, you should make Mac OS X
60partitions with the Mac OS X Disk Utility program and Linux partitions
61with the Linux \fBgdisk\fR or GNU Parted program.
srs5694221e0872009-08-29 15:00:31 -040062
srs56948bb78762009-11-24 15:43:49 -050063Upon start, \fBgdisk\fR attempts to identify the partition type in use on
64the disk. If it finds valid GPT data, \fBgdisk\fR will use it. If
65\fBgdisk\fR finds a valid MBR or BSD disklabel but no GPT data, it will
66attempt to convert the MBR or disklabel into GPT form. (BSD disklabels are
67likely to have unusable first and/or final partitions because they overlap
68with the GPT data structures, though.) GPT fdisk can identify, but not use
69data in, Apple Partition Map (APM) disks, which are used on 680x0\- and
70PowerPC\-based Macintoshes. Upon exiting with the 'w' option, \fBgdisk\fR
71replaces the MBR or disklabel with a GPT. \fIThis action is potentially
72dangerous!\fR Your system may become unbootable, and partition type codes
73may become corrupted if the disk uses unrecognized type codes. Boot
74problems are particularly likely if you're multi\-booting with any
75GPT\-unaware OS. If you mistakenly launch \fBgdisk\fR on an MBR disk, you
76can safely exit the program without making any changes by using the 'q'
77option.
srs5694e7b4ff92009-08-18 13:16:10 -040078
srs5694978041c2009-09-21 20:51:47 -040079The MBR\-to\-GPT conversion will leave at least one gap in the partition
srs5694e7b4ff92009-08-18 13:16:10 -040080numbering if the original MBR used logical partitions. These gaps are
81harmless, but you can eliminate them by using the 's' option, if you like.
srs5694978041c2009-09-21 20:51:47 -040082(Doing this may require you to update your \fI/etc/fstab\fR file.)
srs5694e7b4ff92009-08-18 13:16:10 -040083
84When creating a fresh partition table, certain considerations may be in
85order:
86
srs5694978041c2009-09-21 20:51:47 -040087.TP
srs5694e7b4ff92009-08-18 13:16:10 -040088.B *
srs5694978041c2009-09-21 20:51:47 -040089For data (non\-boot) disks, and for boot disks used on BIOS\-based computers
srs5694e7b4ff92009-08-18 13:16:10 -040090with GRUB as the boot loader, partitions may be created in whatever order
91and in whatever sizes are desired.
92
srs5694978041c2009-09-21 20:51:47 -040093.TP
srs5694e7b4ff92009-08-18 13:16:10 -040094.B *
srs5694978041c2009-09-21 20:51:47 -040095Boot disks for EFI\-based systems require an \fIEFI System
96Partition\fR (\fBgdisk\fR internal code 0xEF00) formatted as FAT\-32.
srs56948bb78762009-11-24 15:43:49 -050097The recommended size of this partition is between 100 and 200 MiB.
srs5694978041c2009-09-21 20:51:47 -040098Boot\-related files are stored here. (Note that GNU Parted identifies
99such partitions as having the "boot flag" set.)
srs5694e7b4ff92009-08-18 13:16:10 -0400100
srs5694978041c2009-09-21 20:51:47 -0400101.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400102.B *
srs5694978041c2009-09-21 20:51:47 -0400103Some boot loaders for BIOS\-based systems make use of a \fIBIOS Boot
srs56948bb78762009-11-24 15:43:49 -0500104Partition\fR (\fBgdisk\fR internal code 0xEF02), in which the secondary
105boot loader is stored, possibly without the benefit of a filesystem. This
106partition can typically be quite small (roughly 32 to 200 KiB), but you
107should consult your boot loader documentation for details.
srs56942a9f5da2009-08-26 00:48:01 -0400108
srs5694978041c2009-09-21 20:51:47 -0400109.TP
srs56942a9f5da2009-08-26 00:48:01 -0400110.B *
srs5694978041c2009-09-21 20:51:47 -0400111If Windows is to boot from a GPT disk, a partition of type \fIMicrosoft
112Reserved\fR (\fBgdisk\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400113internal code 0x0C01) is recommended. This partition should be about 128 MiB
114in size. It ordinarily follows the EFI System Partition and immediately
115precedes the Windows data partitions. (Note that GNU Parted creates all
116FAT partitions as this type, which actually makes the partition unusable
117for normal file storage in both Windows and Mac OS X.)
118
srs5694978041c2009-09-21 20:51:47 -0400119.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400120.B *
121Some OSes' GPT utilities create some blank space (typically 128 MiB) after
122each partition. The intent is to enable future disk utilities to use this
123space. Such free space is not required of GPT disks, but creating it may
srs5694e4ac11e2009-08-31 10:13:04 -0400124help in future disk maintenance. You can use GPT fdisk's relative partition
125positioning option (specifying the starting sector as '+128M', for
126instance) to simplify creating such gaps.
srs5694e7b4ff92009-08-18 13:16:10 -0400127
srs5694978041c2009-09-21 20:51:47 -0400128.SH "OPTIONS"
129.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400130.B \-l
131List the partition tables for the specified devices and then exit.
srs5694978041c2009-09-21 20:51:47 -0400132.PP
srs5694e7b4ff92009-08-18 13:16:10 -0400133
srs5694978041c2009-09-21 20:51:47 -0400134Most interactions with \fBgdisk\fR
135occur with its interactive text\-mode menus. Three menus exist: the main
136menu, the recovery & transformation menu, and the experts' menu. The main
137menu provides the functions that are most likely to be useful for typical partitioning tasks, such as creating and deleting partitions, changing partition type codes, and so on. Specific functions are:
srs5694e7b4ff92009-08-18 13:16:10 -0400138
srs5694978041c2009-09-21 20:51:47 -0400139.TP
srs5694221e0872009-08-29 15:00:31 -0400140.B b
srs56948bb78762009-11-24 15:43:49 -0500141Save partition data to a backup file. You can back up your current
142in-memory partition table to a disk file using this option. The resulting
143file is a binary file consisting of the protective MBR, the main GPT
144header, the backup GPT header, and one copy of the partition table, in that
145order. Note that the backup is of the current in-memory data structures, so
146if you launch the program, make changes, and then use this option, the
147backup will reflect your changes. Note also that the restore option is on
148the recovery & transformation menu; the backup option is on the main menu
149to encourage its use.
srs5694221e0872009-08-29 15:00:31 -0400150
srs5694978041c2009-09-21 20:51:47 -0400151
152.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400153.B c
srs5694978041c2009-09-21 20:51:47 -0400154Change the GPT name of a partition. This name is encoded as a UTF\-16
155string, but \fBgdisk\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400156supports only ASCII characters as names. For the most part, Linux ignores
srs5694221e0872009-08-29 15:00:31 -0400157the partition name, but it may be important in some OSes. GPT fdisk sets
158a default name based on the partition type code.
srs5694e7b4ff92009-08-18 13:16:10 -0400159
srs5694978041c2009-09-21 20:51:47 -0400160.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400161.B d
162Delete a partition. This action deletes the entry from the partition table
163but does not disturb the data within the sectors originally allocated to
srs5694e4ac11e2009-08-31 10:13:04 -0400164the partition on the disk. If a corresponding hybrid MBR partition exists,
srs5694978041c2009-09-21 20:51:47 -0400165\fBgdisk\fR deletes it, as well, and expands any adjacent 0xEE (EFI GPT)
166MBR protective partition to fill the new free space.
srs5694e7b4ff92009-08-18 13:16:10 -0400167
srs5694978041c2009-09-21 20:51:47 -0400168.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400169.B i
170Show detailed partition information. The summary information produced by
171the 'p' command necessarily omits many details, such as the partition's
srs5694978041c2009-09-21 20:51:47 -0400172unique GUID and the translation of \fBgdisk\fR's
srs5694e7b4ff92009-08-18 13:16:10 -0400173internal partition type code to a plain type name. The 'i' option
174displays this information for a single partition.
175
srs5694978041c2009-09-21 20:51:47 -0400176.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400177.B l
178Display a summary of partition types. GPT uses a GUID to identify
179partition types for particular OSes and purposes. For ease of data entry,
srs5694978041c2009-09-21 20:51:47 -0400180\fBgdisk\fR compresses these into two\-byte (four\-digit hexadecimal)
181values that are related to their equivalent MBR codes. Specifically, the
182MBR code is multiplied by hexadecimal 0x0100. For instance, the code for
183Linux swap space in MBR is 0x82, and it's 0x8200 in \fBgdisk\fR.
184A one\-to\-one correspondence is impossible, though. Most notably, many DOS,
srs5694e7b4ff92009-08-18 13:16:10 -0400185Windows, and Linux data partition codes correspond to a single GPT code
srs5694978041c2009-09-21 20:51:47 -0400186(entered as 0x0700 in \fBgdisk\fR). Some OSes use a single MBR code but
187employ many more codes in GPT. For these, \fBgdisk\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400188adds code numbers sequentially, such as 0xa500 for a FreeBSD disklabel,
1890xa501 for FreeBSD boot, 0xa502 for FreeBSD swap, and so on. Note that
srs5694978041c2009-09-21 20:51:47 -0400190these two\-byte codes are unique to \fBgdisk\fR.
srs5694e7b4ff92009-08-18 13:16:10 -0400191
srs5694978041c2009-09-21 20:51:47 -0400192.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400193.B n
194Create a new partition. This command is modelled after the equivalent
srs5694978041c2009-09-21 20:51:47 -0400195\fBfdisk\fR option, although some differences exist. You enter a partition
196number, starting sector, and an ending sector. Both start and end sectors
srs56948bb78762009-11-24 15:43:49 -0500197can be specified in absolute terms as sector numbers or as positions
198measured in kilobytes (K), megabytes (M), gigabytes (G), or terabytes (T);
199for instance, \fI\fB40M\fR\fR specifies a position 40MiB from the start of
200the disk. You can specify locations relative to the start or end of the
srs5694ba00fed2010-01-12 18:18:36 -0500201specified default range by preceding the number by a '+' or '\-' symbol, as
202in \fI\fB+2G\fR\fR to specify a point 2GiB after the default start sector,
srs56948bb78762009-11-24 15:43:49 -0500203or \fI\fB\-200M\fR\fR to specify a point 200MiB before the last available
204sector. Pressing the Enter key with no input specifies the default value,
205which is the start of the largest available block for the start sector and
srs5694ba00fed2010-01-12 18:18:36 -0500206the end of the same block for the end sector.
srs5694e7b4ff92009-08-18 13:16:10 -0400207
srs5694978041c2009-09-21 20:51:47 -0400208.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400209.B o
210Clear out all partition data. This includes GPT header data,
211all partition definitions, and the protective MBR.
212
srs5694978041c2009-09-21 20:51:47 -0400213.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400214.B p
215Display basic partition summary data. This includes partition
216numbers, starting and ending sector numbers, partition sizes,
srs5694978041c2009-09-21 20:51:47 -0400217\fBgdisk\fR's partition types codes, and partition names. For
218additional information, use the 'i' command.
srs5694e7b4ff92009-08-18 13:16:10 -0400219
srs5694978041c2009-09-21 20:51:47 -0400220.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400221.B q
srs5694978041c2009-09-21 20:51:47 -0400222Quit from the program \fIwithout saving your changes\fR.
srs56942a9f5da2009-08-26 00:48:01 -0400223Use this option if you just wanted to view information or if you make a
224mistake and want to back out of all your changes.
srs5694e7b4ff92009-08-18 13:16:10 -0400225
srs5694978041c2009-09-21 20:51:47 -0400226.TP
227.B r
228Enter the recovery & transformation menu. This menu includes emergency
229recovery options (to fix damaged GPT data structures) and options to
230transform to or from other partitioning systems, including creating
231hybrid MBRs.
232
233.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400234.B s
235Sort partition entries. GPT partition numbers need not match the order of
236partitions on the disk. If you want them to match, you can use this option.
srs56948bb78762009-11-24 15:43:49 -0500237Note that some partitioning utilities sort partitions whenever they make
238changes. Such changes will be reflected in your device filenames, so you
239may need to edit \fI/etc/fstab\fR if you use this option.
srs5694e7b4ff92009-08-18 13:16:10 -0400240
srs5694978041c2009-09-21 20:51:47 -0400241.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400242.B t
243Change a single partition's type code. You enter the type code using a
srs5694978041c2009-09-21 20:51:47 -0400244two\-byte hexadecimal number, as described earlier. You may also enter a
245GUID directly, if you have one and \fBgdisk\fR doesn't know it.
srs5694e7b4ff92009-08-18 13:16:10 -0400246
srs5694978041c2009-09-21 20:51:47 -0400247.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400248.B v
249Verify disk. This option checks for a variety of problems, such as
250incorrect CRCs and mismatched main and backup data. This option does not
srs5694978041c2009-09-21 20:51:47 -0400251automatically correct most problems, though; for that, you must use
252options on the recovery & transformation menu. If no problems are found,
253this command displays a summary of unallocated disk space.
srs5694e7b4ff92009-08-18 13:16:10 -0400254
srs5694978041c2009-09-21 20:51:47 -0400255.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400256.B w
257Write data. Use this command to save your changes.
258
srs5694978041c2009-09-21 20:51:47 -0400259.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400260.B x
261Enter the experts' menu. Using this option provides access to features you
262can use to get into even more trouble than the main menu allows.
srs5694978041c2009-09-21 20:51:47 -0400263.PP
srs5694e7b4ff92009-08-18 13:16:10 -0400264
srs5694978041c2009-09-21 20:51:47 -0400265.TP
266.B ?
267Print the menu. Type this command (or any other unrecognized command) to
268see a summary of available options.
srs5694e7b4ff92009-08-18 13:16:10 -0400269
srs5694978041c2009-09-21 20:51:47 -0400270.PP
271The second \fBgdisk\fR menu is the recovery & transformation menu, which
272provides access to data recovery options and features related to the
273transformation of partitions between partitioning schemes (converting
274BSD disklabels into GPT partitions or creating hybrid MBRs, for instance).
275A few options on this menu duplicate functionality on the main
276menu, for the sake of convenience. The options on this menu are:
277
278.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400279.B b
srs5694978041c2009-09-21 20:51:47 -0400280Rebuild GPT header from backup. You can use the backup GPT header to
srs5694e7b4ff92009-08-18 13:16:10 -0400281rebuild the main GPT header with this option. It's likely to be useful if
282your main GPT header was damaged or destroyed (say, by sloppy use of
srs5694978041c2009-09-21 20:51:47 -0400283\fBdd\fR).
284
285.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400286.B c
srs5694978041c2009-09-21 20:51:47 -0400287Load backup partition table. Ordinarily, \fBgdisk\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400288uses only the main partition table (although the backup's integrity is
289checked when you launch the program). If the main partition table has been
290damaged, you can use this option to load the backup from disk and use it
291instead. Note that this will almost certainly produce no or strange
292partition entries if you've just converted an MBR disk to GPT format, since
293there will be no backup partition table on disk.
294
srs5694978041c2009-09-21 20:51:47 -0400295.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400296.B d
297Use main GPT header and rebuild the backup. This option is likely to be
298useful if the backup GPT header has been damaged or destroyed.
srs5694c0ca8f82009-08-20 21:35:25 -0400299
srs5694978041c2009-09-21 20:51:47 -0400300.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400301.B e
302Load main partition table. This option reloads the main partition table
303from disk. It's only likely to be useful if you've tried to use the backup
304partition table (via 'c') but it's in worse shape then the main partition
305table.
srs5694c0ca8f82009-08-20 21:35:25 -0400306
srs5694978041c2009-09-21 20:51:47 -0400307.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400308.B f
srs5694978041c2009-09-21 20:51:47 -0400309Load MBR and build fresh GPT from it. Use this option if your GPT is corrupt
310or conflicts with the MBR and you want to use the MBR as the basis for a new
311set of GPT partitions.
312
313.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400314.B g
srs5694978041c2009-09-21 20:51:47 -0400315Convert GPT into MBR and exit. This option converts up to four GPT partitions
316into MBR form, destroys the GPT data structures, saves the new MBR, and exits.
317Use this option if you've tried GPT and find that MBR works better for you.
318Note that this function generates up to four \fIprimary\fR MBR partitions;
319it cannot generate logical partitions, and so it cannot transform more than
320four partitions. If four or fewer partitions exist, and if they can be represented
321in the 32\-bit MBR LBA scheme, this function converts
322them all. If more than four partitions exist, you'll be asked to select which
323ones to convert. See also the 'h' option.
srs5694c0ca8f82009-08-20 21:35:25 -0400324
srs5694978041c2009-09-21 20:51:47 -0400325.TP
srs5694c0ca8f82009-08-20 21:35:25 -0400326.B h
srs5694978041c2009-09-21 20:51:47 -0400327Create a hybrid MBR. This is an ugly workaround that enables GPT\-unaware
328OSes, or those that can't boot from a GPT disk, to access up to three of
srs5694c0ca8f82009-08-20 21:35:25 -0400329the partitions on the disk by creating MBR entries for them. Note that
srs5694978041c2009-09-21 20:51:47 -0400330these hybrid MBR entries can easily go out of sync with the GPT entries,
331particularly when hybrid\-unaware GPT utilities are used to edit the disk.
332Thus, you may need to recreate the hybrid MBR if you use such tools.
srs5694c0ca8f82009-08-20 21:35:25 -0400333
srs5694978041c2009-09-21 20:51:47 -0400334.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400335.B i
336Show detailed partition information. This option is identical to the 'i'
337option on the main menu.
srs5694978041c2009-09-21 20:51:47 -0400338
339.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400340.B l
srs5694978041c2009-09-21 20:51:47 -0400341Load partition data from a backup file. This option is the reverse of the 'b'
342option on the main menu. Note that restoring partition data from anything
343but the original disk is not recommended.
344
345.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400346.B m
srs5694978041c2009-09-21 20:51:47 -0400347Return to the main menu. This option enables you to enter main\-menu commands.
348
349.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400350.B o
351Print protective MBR data. You can see a summary of the protective MBR's
352partitions with this option. This may enable you to spot glaring problems
353or help identify the partitions in a hybrid MBR.
srs5694978041c2009-09-21 20:51:47 -0400354
355.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400356.B p
357Print the partition table. This option is identical to the 'p' option in
358the main menu.
srs5694978041c2009-09-21 20:51:47 -0400359
360.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400361.B q
362Quit without saving changes. This option is identical to the 'q' option in
363the main menu.
srs56942a9f5da2009-08-26 00:48:01 -0400364
srs5694978041c2009-09-21 20:51:47 -0400365.TP
366.B t
367Transform BSD partitions into GPT partitions. This option works on BSD
368disklabels held within GPT (or converted MBR) partitions. Converted
369partitions' type codes are likely to need manual adjustment. \fBgdisk\fR
370will attempt to convert BSD disklabels stored on the main disk when
371launched, but this conversion is likely to produce first and/or last
372partitions that are unusable. The many BSD variants means that the
373probability of \fBgdisk\fR being unable to convert a BSD disklabel is
374high compared to the likelihood of problems with an MBR conversion.
375
376.TP
377.B v
378Verify disk. This option is identical to the 'v' option in the main menu.
379
380.TP
381.B w
382Write table to disk and exit. This option is identical to the 'w' option in
383the main menu.
384
385.TP
386.B x
387Enter the experts' menu. This option is identical to the 'x' option in the
388main menu.
389
390.TP
391.B ?
392Print the menu. This option (or any unrecognized entry) displays a summary
393of the menu options.
394
395.PP
396The third \fBgdisk\fR menu is the experts' menu. This menu provides advanced
397options that aren't closely related to recovery or transformation between
398partitioning systems. Its options are:
399
400.TP
401.B a
402Set attributes. GPT provides a 64\-bit attributes field that can be used to
403set features for each partition. \fBgdisk\fR supports four attributes:
404\fIsystem partition\fR, \fIread\-only\fR, \fIhidden\fR, and
405\fIdo not automount\fR. You can set other attributes, but their numbers
406aren't translated into anything useful. In practice, most OSes seem to
407ignore these attributes.
408
409.TP
410.B c
411Change partition GUID. You can enter a custom unique GUID for a partition
412using this option. (Note this refers to the GUID that uniquely identifies a
413partition, not to its type code, which you can change with the 't' main\-menu
414option.) Ordinarily, \fBgdisk\fR assigns this number randomly; however,
415you might want to adjust the number manually if you've wound up with the
416same GUID on two partitions because of buggy GUID assignments (hopefully
417not in \fBgdisk\fR) or sheer incredible coincidence.
418
srs56948bb78762009-11-24 15:43:49 -0500419.TP
srs56941d1448a2009-12-31 21:20:19 -0500420.B d
421Display the number of logical sectors per physical sector. This value
422determines the sector alignment that GPT fdisk enforces. See the
srs56945d58fe02010-01-03 20:57:08 -0500423description of the 'l' option for more details. Note that this value is
424only auto-detected on Linux with a 2.6.32 kernel or later; on other
425platforms, it defaults to 8.
srs56941d1448a2009-12-31 21:20:19 -0500426
427.TP
srs56948bb78762009-11-24 15:43:49 -0500428.B e
srs56941d1448a2009-12-31 21:20:19 -0500429Move backup GPT data structures to the end of the disk. Use this command if
430you've added disks to a RAID array, thus creating a virtual disk with space
431that follows the backup GPT data structures. This command moves the backup
432GPT data structures to the end of the disk, where they belong.
srs56948bb78762009-11-24 15:43:49 -0500433
srs5694978041c2009-09-21 20:51:47 -0400434.TP
435.B g
436Change disk GUID. Each disk has a unique GUID code, which \fBgdisk\fR
437assigns randomly upon creation of the GPT data structures. You can generate
438a fresh random GUID or enter one manually with this option.
439
440.TP
441.B i
442Show detailed partition information. This option is identical to the 'i'
443option on the main menu.
444
srs56941d1448a2009-12-31 21:20:19 -0500445.TP
446.B l
447Change the number of logical sectors per physical sector. Prior to December
448of 2009, most hard disks used 512-byte physical sectors. Starting in
449December of 2009, disk manufacturers began transitioning to disks with
450larger physical sectors, but their firmware translated to 512-byte logical
451sectors to maintain compatibility with older OSes. If partitions begin
452mid-physical-sector, though, performance can suffer on such drives, since
453important filesystem data structures can span physical sectors on the disk.
454To minimize such problems, GPT fdisk aligns the start of partitions on the
455boundary of presumed physical sectors. You can set the number of logical
srs56940a697312010-01-28 21:10:52 -0500456sectors per physical sector with this option. The default is 1 on disks
457smaller than 800GB and 8 on larger disks.
srs56941d1448a2009-12-31 21:20:19 -0500458
srs5694978041c2009-09-21 20:51:47 -0400459.TP
460.B m
461Return to the main menu. This option enables you to enter main\-menu commands.
462
463.TP
464.B n
465Create a new protective MBR. Use this option if the current protective MBR
466is damaged in a way that \fBgdisk\fR doesn't automatically detect and
467correct, or if you want to convert a hybrid MBR into a "pure" GPT with a
468conventional protective MBR.
469
470.TP
471.B o
472Print protective MBR data. You can see a summary of the protective MBR's
473partitions with this option. This may enable you to spot glaring problems
474or help identify the partitions in a hybrid MBR.
475
476.TP
477.B p
478Print the partition table. This option is identical to the 'p' option in
479the main menu.
480
481.TP
482.B q
483Quit without saving changes. This option is identical to the 'q' option in
484the main menu.
485
486.TP
487.B r
488Enter the recovery & transformations menu. This option is identical to
489the 'r' option on the main menu.
490
491.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400492.B s
srs56942a9f5da2009-08-26 00:48:01 -0400493Resize partition table. The default partition table size is 128 entries.
494Officially, sizes of less than 16KB (128 entries, given the normal entry
495size) are unsupported by the GPT specification; however, in practice they
496seem to work, and can sometimes be useful in converting MBR disks. Larger
497sizes also work fine. OSes may impose their own limits on the number of
498partitions, though.
499
srs569408bb0da2010-02-19 17:19:55 -0500500.TP
501.B t
502Swap two partitions' entries in the partition table. One partition may be
503empty. For instance, if partitions 1\-4 are defined, transposing 1 and 5
504results in a table with partitions numbered from 2\-5. Transposing
505partitions in this way has no effect on their disk space allocation; it
506only alters their order in the partition table.
507
srs5694978041c2009-09-21 20:51:47 -0400508.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400509.B v
510Verify disk. This option is identical to the 'v' option in the main menu.
srs5694c0ca8f82009-08-20 21:35:25 -0400511
srs5694978041c2009-09-21 20:51:47 -0400512.TP
srs5694c0ca8f82009-08-20 21:35:25 -0400513.B z
srs5694978041c2009-09-21 20:51:47 -0400514Zap (destroy) the GPT data structures and exit. Use this option if you want to
515repartition a GPT disk using \fBfdisk\fR or some other GPT\-unaware program.
srs5694c0ca8f82009-08-20 21:35:25 -0400516You'll be given the choice of preserving the existing MBR, in case it's a
srs5694978041c2009-09-21 20:51:47 -0400517hybrid MBR with salvageable partitions or if you've already created new MBR
518partitions and want to erase the remnants of your GPT partitions. \fIIf you've
519already created new MBR partitions, it's conceivable that this option will
520damage the first and/or last MBR partitions!\fR Such an event is unlikely, but
521could occur if your new MBR partitions overlap the old GPT data structures.
srs5694c0ca8f82009-08-20 21:35:25 -0400522
srs5694978041c2009-09-21 20:51:47 -0400523.TP
524.B ?
525Print the menu. This option (or any unrecognized entry) displays a summary
526of the menu options.
srs5694e7b4ff92009-08-18 13:16:10 -0400527
srs5694978041c2009-09-21 20:51:47 -0400528.PP
srs5694e7b4ff92009-08-18 13:16:10 -0400529In many cases, you can press the Enter key to select a default option when
srs5694978041c2009-09-21 20:51:47 -0400530entering data. When only one option is possible, \fBgdisk\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400531usually bypasses the prompt entirely.
532
srs5694978041c2009-09-21 20:51:47 -0400533.SH "BUGS"
srs56945d58fe02010-01-03 20:57:08 -0500534As of January 2010 (version 0.5.3), \fBgdisk\fR
srs5694e4ac11e2009-08-31 10:13:04 -0400535should be considered beta software. Known bugs and limitations include:
srs5694e7b4ff92009-08-18 13:16:10 -0400536
srs5694978041c2009-09-21 20:51:47 -0400537.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400538.B *
srs5694978041c2009-09-21 20:51:47 -0400539The program compiles correctly only on Linux, FreeBSD, and Mac OS X. Linux
540versions for x86\-64 (64\-bit), x86 (32\-bit), and PowerPC (32\-bit) have been
srs5694ba00fed2010-01-12 18:18:36 -0500541tested, with the x86\-64 version having seen the most testing.
srs5694e4ac11e2009-08-31 10:13:04 -0400542
srs5694978041c2009-09-21 20:51:47 -0400543.TP
srs5694e4ac11e2009-08-31 10:13:04 -0400544.B *
545The FreeBSD version of the program can't write changes to the partition
546table to a disk when existing partitions on that disk are mounted. (The
547same problem exists with many other FreeBSD utilities, such as
srs56947dbb9322010-01-20 16:56:30 -0500548\fBgpt\fR, \fBfdisk\fR, and \fBdd\fR.) This limitation can be overcome
549by typing \fBsysctl kern.geom.debugflags=16\fR at a shell prompt.
srs5694e4ac11e2009-08-31 10:13:04 -0400550
srs5694978041c2009-09-21 20:51:47 -0400551.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400552.B *
srs5694e7b4ff92009-08-18 13:16:10 -0400553The fields used to display the start and end sector numbers for partitions
554in the 'p' command are 14 characters wide. This translates to a limitation
555of about 45 PiB. On larger disks, the displayed columns will go out of
556alignment.
557
srs5694978041c2009-09-21 20:51:47 -0400558.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400559.B *
560Only ASCII characters are supported in the partition name field. If an
srs5694978041c2009-09-21 20:51:47 -0400561existing partition uses non\-ASCII UTF\-16 characters, they're likely to be
562corrupted in the 'i' and 'p' menu options' displays; however, they should be
srs5694e7b4ff92009-08-18 13:16:10 -0400563preserved when loading and saving partitions.
564
srs5694978041c2009-09-21 20:51:47 -0400565.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400566.B *
srs5694978041c2009-09-21 20:51:47 -0400567The program can load only up to 128 partitions (4 primary partitions and
568124 logical partitions) when converting from MBR format. This limit can
569be raised by changing the \fI#define MAX_MBR_PARTS\fR line in the
570\fImbr.h\fR source code file and recompiling; however, such a change
srs56948bb78762009-11-24 15:43:49 -0500571will require using a larger\-than\-normal partition table. (The limit
srs5694978041c2009-09-21 20:51:47 -0400572of 128 partitions was chosen because that number equals the 128 partitions
srs56948bb78762009-11-24 15:43:49 -0500573supported by the most common partition table size.)
srs5694e7b4ff92009-08-18 13:16:10 -0400574
srs5694978041c2009-09-21 20:51:47 -0400575.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400576.B *
577Converting from MBR format sometimes fails because of insufficient space at
578the start or (more commonly) the end of the disk. Resizing the partition
579table (using the 's' option in the experts' menu) can sometimes overcome
580this problem; however, in extreme cases it may be necessary to resize a
srs5694978041c2009-09-21 20:51:47 -0400581partition using GNU Parted or a similar tool prior to conversion with
582\fBgdisk\fR.
srs5694e7b4ff92009-08-18 13:16:10 -0400583
srs5694978041c2009-09-21 20:51:47 -0400584.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400585.B *
srs5694e7b4ff92009-08-18 13:16:10 -0400586MBR conversions work only if the disk has correct LBA partition
587descriptors. These descriptors should be present on any disk over 8 GiB in
588size or on smaller disks partitioned with any but very ancient software.
589
srs5694978041c2009-09-21 20:51:47 -0400590.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400591.B *
srs5694e4ac11e2009-08-31 10:13:04 -0400592BSD disklabel support can create first and/or last partitions that overlap
593with the GPT data structures. This can sometimes be compensated by
594adjusting the partition table size, but in extreme cases the affected
595partition(s) may need to be deleted.
srs5694e7b4ff92009-08-18 13:16:10 -0400596
srs5694978041c2009-09-21 20:51:47 -0400597.TP
srs5694e7b4ff92009-08-18 13:16:10 -0400598.B *
srs5694e4ac11e2009-08-31 10:13:04 -0400599Because of the highly variable nature of BSD disklabel structures,
srs5694978041c2009-09-21 20:51:47 -0400600conversions from this form may be unreliable \-\- partitions may be dropped,
srs5694e4ac11e2009-08-31 10:13:04 -0400601converted in a way that creates overlaps with other partitions, or
602converted with incorrect start or end values. Use this feature with
603caution!
604
srs5694978041c2009-09-21 20:51:47 -0400605.TP
srs5694e4ac11e2009-08-31 10:13:04 -0400606.B *
607Booting after converting an MBR or BSD disklabel disk is likely to be
srs5694978041c2009-09-21 20:51:47 -0400608disrupted. Sometimes re\-installing a boot loader will fix the problem, but
609other times you may need to switch boot loaders. Except on EFI\-based
srs5694e4ac11e2009-08-31 10:13:04 -0400610platforms, Windows through at least Windows 7 RC doesn't support booting
srs5694978041c2009-09-21 20:51:47 -0400611from GPT disks. Creating a hybrid MBR (using the 'h' option on the recovery &
612transformation menu) or abandoning GPT in favor of MBR may be your only
613options in this case.
srs5694c0ca8f82009-08-20 21:35:25 -0400614
srs5694978041c2009-09-21 20:51:47 -0400615.PP
srs5694e7b4ff92009-08-18 13:16:10 -0400616
srs5694978041c2009-09-21 20:51:47 -0400617The support for big\-endian CPUs (PowerPC, for example) is new, as of version
srs56942a9f5da2009-08-26 00:48:01 -04006180.3.5. I advise using caution on that platform, particularly with the more
619obscure features of the program.
620
srs5694978041c2009-09-21 20:51:47 -0400621.SH "AUTHORS"
srs5694e7b4ff92009-08-18 13:16:10 -0400622Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
623
624Contributors:
625
626* Yves Blusseau (1otnwmz02@sneakemail.com)
627
srs56947f244ba2009-08-18 14:22:12 -0400628* David Hubbard (david.c.hubbard@gmail.com)
srs5694e7b4ff92009-08-18 13:16:10 -0400629
630.SH "SEE ALSO"
srs5694978041c2009-09-21 20:51:47 -0400631\fBcfdisk (8)\fR,
632\fBfdisk (8)\fR,
633\fBmkfs (8)\fR,
634\fBparted (8)\fR,
635\fBsfdisk (8)\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400636
srs5694978041c2009-09-21 20:51:47 -0400637\fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400638
srs5694978041c2009-09-21 20:51:47 -0400639\fIhttp://developer.apple.com/technotes/tn2006/tn2166.html\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400640
srs5694978041c2009-09-21 20:51:47 -0400641\fIhttp://www.rodsbooks.com/gdisk/\fR
srs5694e7b4ff92009-08-18 13:16:10 -0400642
srs5694978041c2009-09-21 20:51:47 -0400643.SH "AVAILABILITY"
644The \fBgdisk\fR command is part of the \fIGPT fdisk\fR package and is
645available from Rod Smith.