Blame gdisk.html

Packit 062bc7
Content-type: text/html; charset=UTF-8
Packit 062bc7
Packit 062bc7
Packit 062bc7
<HTML><HEAD><TITLE>Man page of GDISK</TITLE>
Packit 062bc7
</HEAD><BODY>
Packit 062bc7

GDISK

Packit 062bc7
Section: GPT fdisk Manual (8)
Updated: 1.0.3
Index
Packit 062bc7
Return to Main Contents
Packit 062bc7
Packit 062bc7
 
Packit 062bc7

NAME

Packit 062bc7
Packit 062bc7
gdisk - Interactive GUID partition table (GPT) manipulator
Packit 062bc7
 
Packit 062bc7

SYNOPSIS

Packit 062bc7
Packit 062bc7
gdisk 
Packit 062bc7
Packit 062bc7
[ -l ]
Packit 062bc7
device
Packit 062bc7
Packit 062bc7

Packit 062bc7
 
Packit 062bc7

DESCRIPTION

Packit 062bc7
Packit 062bc7
GPT fdisk (aka gdisk) is a text-mode menu-driven program for
Packit 062bc7
creation and manipulation of partition tables. It will automatically
Packit 062bc7
convert an old-style Master Boot Record (MBR) partition table or BSD
Packit 062bc7
disklabel stored without an MBR carrier partition to the newer Globally
Packit 062bc7
Unique Identifier (GUID) Partition Table (GPT) format, or will load a GUID
Packit 062bc7
partition table. When used with the -l command-line option, the
Packit 062bc7
program displays the current partition table and then exits.
Packit 062bc7

Packit 062bc7
GPT fdisk operates mainly on the GPT headers and partition tables; however,
Packit 062bc7
it can and will generate a fresh protective MBR, when required. (Any boot
Packit 062bc7
loader code in the protective MBR will not be disturbed.) If you've created
Packit 062bc7
an unusual protective MBR, such as a hybrid MBR created by
Packit 062bc7
gptsync or gdisk's own hybrid MBR creation feature,
Packit 062bc7
this should not be disturbed by most ordinary actions. Some advanced data
Packit 062bc7
recovery options require you to understand the distinctions between the
Packit 062bc7
main and backup data, as well as between the GPT headers and the partition
Packit 062bc7
tables. For information on MBR vs. GPT, as well as GPT terminology and
Packit 062bc7
structure, see the extended gdisk documentation at
Packit 062bc7
http://www.rodsbooks.com/gdisk/ or consult Wikipedia.
Packit 062bc7

Packit 062bc7
The gdisk program employs a user interface similar to that of Linux's
Packit 062bc7
fdisk, but gdisk modifies GPT partitions. It also has the
Packit 062bc7
capability of transforming MBR partitions or BSD disklabels into GPT
Packit 062bc7
partitions. Like the original fdisk program, gdisk does not
Packit 062bc7
modify disk structures until you explicitly write them to disk, so if you
Packit 062bc7
make a mistake, you can exit from the program with the 'q' option to leave
Packit 062bc7
your partitions unmodified.
Packit 062bc7

Packit 062bc7
Ordinarily, gdisk operates on disk device files, such as
Packit 062bc7
/dev/sda or /dev/hda under Linux, /dev/disk0 under
Packit 062bc7
Mac OS X, or /dev/ad0 or /dev/da0 under FreeBSD. The program
Packit 062bc7
can also operate on disk image files, which can be either copies of whole
Packit 062bc7
disks (made with dd, for instance) or raw disk images used by
Packit 062bc7
emulators such as QEMU or VMWare. Note that only raw disk images
Packit 062bc7
are supported; gdisk cannot work on compressed or other advanced
Packit 062bc7
disk image formats.
Packit 062bc7

Packit 062bc7
The MBR partitioning system uses a combination of cylinder/head/sector
Packit 062bc7
(CHS) addressing and logical block addressing (LBA). The former is klunky
Packit 062bc7
and limiting. GPT drops CHS addressing and uses 64-bit LBA mode
Packit 062bc7
exclusively. Thus, GPT data structures, and therefore
Packit 062bc7
gdisk, do not need to deal with CHS geometries and all the problems
Packit 062bc7
they create. Users of fdisk will note that gdisk
Packit 062bc7
lacks the options and limitations associated with CHS geometries.
Packit 062bc7

Packit 062bc7
For best results, you should use an OS-specific partition table
Packit 062bc7
program whenever possible. For example, you should make Mac OS X
Packit 062bc7
partitions with the Mac OS X Disk Utility program and Linux partitions
Packit 062bc7
with the Linux gdisk or GNU Parted program.
Packit 062bc7

Packit 062bc7
Upon start, gdisk attempts to identify the partition type in use on
Packit 062bc7
the disk. If it finds valid GPT data, gdisk will use it. If
Packit 062bc7
gdisk finds a valid MBR or BSD disklabel but no GPT data, it will
Packit 062bc7
attempt to convert the MBR or disklabel into GPT form. (BSD disklabels are
Packit 062bc7
likely to have unusable first and/or final partitions because they overlap
Packit 062bc7
with the GPT data structures, though.) GPT fdisk can identify, but not use
Packit 062bc7
data in, Apple Partition Map (APM) disks, which are used on 680x0- and
Packit 062bc7
PowerPC-based Macintoshes. Upon exiting with the 'w' option, gdisk
Packit 062bc7
replaces the MBR or disklabel with a GPT. This action is potentially
Packit 062bc7
dangerous! Your system may become unbootable, and partition type codes
Packit 062bc7
may become corrupted if the disk uses unrecognized type codes. Boot
Packit 062bc7
problems are particularly likely if you're multi-booting with any
Packit 062bc7
GPT-unaware OS. If you mistakenly launch gdisk on an MBR disk, you
Packit 062bc7
can safely exit the program without making any changes by using the 'q'
Packit 062bc7
option.
Packit 062bc7

Packit 062bc7
The MBR-to-GPT conversion will leave at least one gap in the partition
Packit 062bc7
numbering if the original MBR used logical partitions. These gaps are
Packit 062bc7
harmless, but you can eliminate them by using the 's' option, if you like.
Packit 062bc7
(Doing this may require you to update your /etc/fstab file.)
Packit 062bc7

Packit 062bc7
When creating a fresh partition table, certain considerations may be in
Packit 062bc7
order:
Packit 062bc7

Packit 062bc7
Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
For data (non-boot) disks, and for boot disks used on BIOS-based computers
Packit 062bc7
with GRUB as the boot loader, partitions may be created in whatever order
Packit 062bc7
and in whatever sizes are desired.
Packit 062bc7

Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
Boot disks for EFI-based systems require an EFI System Partition
Packit 062bc7
(gdisk internal code 0xEF00) formatted as FAT-32. I recommended
Packit 062bc7
making this partition 550 MiB. (Smaller ESPs are common, but some EFIs have
Packit 062bc7
flaky FAT drivers that necessitate a larger partition for reliable
Packit 062bc7
operation.) Boot-related files are stored here. (Note that GNU Parted
Packit 062bc7
identifies such partitions as having the "boot flag" set.)
Packit 062bc7

Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
Some boot loaders for BIOS-based systems make use of a BIOS Boot
Packit 062bc7
Partition (gdisk internal code 0xEF02), in which the secondary
Packit 062bc7
boot loader is stored, possibly without the benefit of a filesystem. (GRUB2
Packit 062bc7
may optionally use such a partition.) This partition can typically be quite
Packit 062bc7
small (roughly 32 to 200 KiB, although 1 MiB is more common in practice),
Packit 062bc7
but you should consult your boot loader documentation for details.
Packit 062bc7

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

Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
Some OSes' GPT utilities create some blank space (typically 128 MiB) after
Packit 062bc7
each partition. The intent is to enable future disk utilities to use this
Packit 062bc7
space. Such free space is not required of GPT disks, but creating it may
Packit 062bc7
help in future disk maintenance. You can use GPT fdisk's relative partition
Packit 062bc7
positioning option (specifying the starting sector as '+128M', for
Packit 062bc7
instance) to simplify creating such gaps.
Packit 062bc7

Packit 062bc7
Packit 062bc7
 
Packit 062bc7

OPTIONS

Packit 062bc7
Packit 062bc7
Packit 062bc7
-l
Packit 062bc7
Packit 062bc7
Packit 062bc7
List the partition table for the specified device and then exits.
Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
Most interactions with gdisk
Packit 062bc7
occur with its interactive text-mode menus. Three menus exist: the main
Packit 062bc7
menu, the recovery & transformation menu, and the experts' menu. The main
Packit 062bc7
menu 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:
Packit 062bc7

Packit 062bc7
Packit 062bc7
b
Packit 062bc7
Packit 062bc7
Packit 062bc7
Save partition data to a backup file. You can back up your current
Packit 062bc7
in-memory partition table to a disk file using this option. The resulting
Packit 062bc7
file is a binary file consisting of the protective MBR, the main GPT
Packit 062bc7
header, the backup GPT header, and one copy of the partition table, in that
Packit 062bc7
order. Note that the backup is of the current in-memory data structures, so
Packit 062bc7
if you launch the program, make changes, and then use this option, the
Packit 062bc7
backup will reflect your changes. Note also that the restore option is on
Packit 062bc7
the recovery & transformation menu; the backup option is on the main menu
Packit 062bc7
to encourage its use.
Packit 062bc7

Packit 062bc7

Packit 062bc7
c
Packit 062bc7
Packit 062bc7
Packit 062bc7
Change the GPT name of a partition. This name is encoded as a UTF-16
Packit 062bc7
string, but proper entry and display of anything beyond basic ASCII values
Packit 062bc7
requires suitable locale and font support. For the most part, Linux ignores
Packit 062bc7
the partition name, but it may be important in some OSes. GPT fdisk sets a
Packit 062bc7
default name based on the partition type code. Note that the GPT partition
Packit 062bc7
name is different from the filesystem name, which is encoded in the
Packit 062bc7
filesystem's data structures.
Packit 062bc7

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

Packit 062bc7
i
Packit 062bc7
Packit 062bc7
Packit 062bc7
Show detailed partition information. The summary information produced by
Packit 062bc7
the 'p' command necessarily omits many details, such as the partition's
Packit 062bc7
unique GUID and the translation of gdisk's
Packit 062bc7
internal partition type code to a plain type name. The 'i' option
Packit 062bc7
displays this information for a single partition.
Packit 062bc7

Packit 062bc7
l
Packit 062bc7
Packit 062bc7
Packit 062bc7
Display a summary of partition types. GPT uses a GUID to identify partition
Packit 062bc7
types for particular OSes and purposes. For ease of data entry, gdisk
Packit 062bc7
compresses these into two-byte (four-digit hexadecimal) values that are
Packit 062bc7
related to their equivalent MBR codes. Specifically, the MBR code is
Packit 062bc7
multiplied by hexadecimal 0x0100. For instance, the code for Linux swap
Packit 062bc7
space in MBR is 0x82, and it's 0x8200 in gdisk. A one-to-one
Packit 062bc7
correspondence is impossible, though. Most notably, the codes for all
Packit 062bc7
varieties of FAT and NTFS partition correspond to a single GPT code
Packit 062bc7
(entered as 0x0700 in sgdisk). Some OSes use a single MBR code but
Packit 062bc7
employ many more codes in GPT. For these, gdisk adds code numbers
Packit 062bc7
sequentially, such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD
Packit 062bc7
boot, 0xa502 for FreeBSD swap, and so on. Note that these two-byte codes
Packit 062bc7
are unique to gdisk.
Packit 062bc7

Packit 062bc7
n
Packit 062bc7
Packit 062bc7
Packit 062bc7
Create a new partition. This command is modeled after the equivalent
Packit 062bc7
fdisk option, although some differences exist. You enter a partition
Packit 062bc7
number, starting sector, and an ending sector. Both start and end sectors
Packit 062bc7
can be specified in absolute terms as sector numbers or as positions
Packit 062bc7
measured in kibibytes (K), mebibytes (M), gibibytes (G), tebibytes (T), or
Packit 062bc7
pebibytes (P); for instance, 40M specifies a position 40MiB
Packit 062bc7
from the start of the disk. You can specify locations relative to the start
Packit 062bc7
or end of the specified default range by preceding the number by a '+' or '-'
Packit 062bc7
symbol, as in +2G to specify a point 2GiB after the
Packit 062bc7
default start sector, or -200M to specify a point 200MiB
Packit 062bc7
before the last available sector. Pressing the Enter key with no input
Packit 062bc7
specifies the default value, which is the start of the largest available
Packit 062bc7
block for the start sector and the end of the same block for the end
Packit 062bc7
sector.
Packit 062bc7

Packit 062bc7
o
Packit 062bc7
Packit 062bc7
Packit 062bc7
Clear out all partition data. This includes GPT header data,
Packit 062bc7
all partition definitions, and the protective MBR. The sector alignment
Packit 062bc7
is reset to the default (1MB, or 2048 sectors on a disk with 512-byte
Packit 062bc7
sectors).
Packit 062bc7

Packit 062bc7
p
Packit 062bc7
Packit 062bc7
Packit 062bc7
Display basic partition summary data. This includes partition
Packit 062bc7
numbers, starting and ending sector numbers, partition sizes,
Packit 062bc7
gdisk's partition types codes, and partition names. For
Packit 062bc7
additional information, use the 'i' command.
Packit 062bc7

Packit 062bc7
q
Packit 062bc7
Packit 062bc7
Packit 062bc7
Quit from the program without saving your changes.
Packit 062bc7
Use this option if you just wanted to view information or if you make a
Packit 062bc7
mistake and want to back out of all your changes.
Packit 062bc7

Packit 062bc7
r
Packit 062bc7
Packit 062bc7
Packit 062bc7
Enter the recovery & transformation menu. This menu includes emergency
Packit 062bc7
recovery options (to fix damaged GPT data structures) and options to
Packit 062bc7
transform to or from other partitioning systems, including creating
Packit 062bc7
hybrid MBRs.
Packit 062bc7

Packit 062bc7
s
Packit 062bc7
Packit 062bc7
Packit 062bc7
Sort partition entries. GPT partition numbers need not match the order of
Packit 062bc7
partitions on the disk. If you want them to match, you can use this option.
Packit 062bc7
Note that some partitioning utilities sort partitions whenever they make
Packit 062bc7
changes. Such changes will be reflected in your device filenames, so you
Packit 062bc7
may need to edit /etc/fstab if you use this option.
Packit 062bc7

Packit 062bc7
t
Packit 062bc7
Packit 062bc7
Packit 062bc7
Change a single partition's type code. You enter the type code using a
Packit 062bc7
two-byte hexadecimal number, as described earlier. You may also enter a
Packit 062bc7
GUID directly, if you have one and gdisk doesn't know it.
Packit 062bc7

Packit 062bc7
v
Packit 062bc7
Packit 062bc7
Packit 062bc7
Verify disk. This option checks for a variety of problems, such as
Packit 062bc7
incorrect CRCs and mismatched main and backup data. This option does not
Packit 062bc7
automatically correct most problems, though; for that, you must use
Packit 062bc7
options on the recovery & transformation menu. If no problems are found,
Packit 062bc7
this command displays a summary of unallocated disk space.
Packit 062bc7

Packit 062bc7
w
Packit 062bc7
Packit 062bc7
Packit 062bc7
Write data. Use this command to save your changes.
Packit 062bc7

Packit 062bc7
x
Packit 062bc7
Packit 062bc7
Packit 062bc7
Enter the experts' menu. Using this option provides access to features you
Packit 062bc7
can use to get into even more trouble than the main menu allows.
Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7
?
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print the menu. Type this command (or any other unrecognized command) to
Packit 062bc7
see a summary of available options.
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7
The second gdisk menu is the recovery & transformation menu, which
Packit 062bc7
provides access to data recovery options and features related to the
Packit 062bc7
transformation of partitions between partitioning schemes (converting
Packit 062bc7
BSD disklabels into GPT partitions or creating hybrid MBRs, for instance).
Packit 062bc7
A few options on this menu duplicate functionality on the main
Packit 062bc7
menu, for the sake of convenience. The options on this menu are:
Packit 062bc7

Packit 062bc7
Packit 062bc7
b
Packit 062bc7
Packit 062bc7
Packit 062bc7
Rebuild GPT header from backup. You can use the backup GPT header to
Packit 062bc7
rebuild the main GPT header with this option. It's likely to be useful if
Packit 062bc7
your main GPT header was damaged or destroyed (say, by sloppy use of
Packit 062bc7
dd).
Packit 062bc7

Packit 062bc7
c
Packit 062bc7
Packit 062bc7
Packit 062bc7
Load backup partition table. Ordinarily, gdisk
Packit 062bc7
uses only the main partition table (although the backup's integrity is
Packit 062bc7
checked when you launch the program). If the main partition table has been
Packit 062bc7
damaged, you can use this option to load the backup from disk and use it
Packit 062bc7
instead. Note that this will almost certainly produce no or strange
Packit 062bc7
partition entries if you've just converted an MBR disk to GPT format, since
Packit 062bc7
there will be no backup partition table on disk.
Packit 062bc7

Packit 062bc7
d
Packit 062bc7
Packit 062bc7
Packit 062bc7
Use main GPT header and rebuild the backup. This option is likely to be
Packit 062bc7
useful if the backup GPT header has been damaged or destroyed.
Packit 062bc7

Packit 062bc7
e
Packit 062bc7
Packit 062bc7
Packit 062bc7
Load main partition table. This option reloads the main partition table
Packit 062bc7
from disk. It's only likely to be useful if you've tried to use the backup
Packit 062bc7
partition table (via 'c') but it's in worse shape then the main partition
Packit 062bc7
table.
Packit 062bc7

Packit 062bc7
f
Packit 062bc7
Packit 062bc7
Packit 062bc7
Load MBR and build fresh GPT from it. Use this option if your GPT is corrupt
Packit 062bc7
or conflicts with the MBR and you want to use the MBR as the basis for a new
Packit 062bc7
set of GPT partitions.
Packit 062bc7

Packit 062bc7
g
Packit 062bc7
Packit 062bc7
Packit 062bc7
Convert GPT into MBR and exit. This option converts as many partitions as possible
Packit 062bc7
into MBR form, destroys the GPT data structures, saves the new MBR, and exits.
Packit 062bc7
Use this option if you've tried GPT and find that MBR works better for you.
Packit 062bc7
Note that this function generates up to four primary MBR partitions or three
Packit 062bc7
primary partitions and as many logical partitions as can be generated. Each
Packit 062bc7
logical partition requires at least one unallocated block immediately before
Packit 062bc7
its first block. Therefore, it may be possible to convert a maximum of four
Packit 062bc7
partitions on disks with tightly-packed partitions; however, if free space was
Packit 062bc7
inserted between partitions when they were created, and if the disk is under
Packit 062bc7
2 TiB in size, it should be possible to convert all the partitions to MBR form.
Packit 062bc7
See also the 'h' option.
Packit 062bc7

Packit 062bc7
h
Packit 062bc7
Packit 062bc7
Packit 062bc7
Create a hybrid MBR. This is an ugly workaround that enables GPT-unaware
Packit 062bc7
OSes, or those that can't boot from a GPT disk, to access up to three of
Packit 062bc7
the partitions on the disk by creating MBR entries for them. Note that
Packit 062bc7
these hybrid MBR entries can easily go out of sync with the GPT entries,
Packit 062bc7
particularly when hybrid-unaware GPT utilities are used to edit the disk.
Packit 062bc7
Thus, you may need to re-create the hybrid MBR if you use such tools. Unlike
Packit 062bc7
the 'g' option, this option does not support converting any partitions into
Packit 062bc7
MBR logical partitions.
Packit 062bc7

Packit 062bc7
i
Packit 062bc7
Packit 062bc7
Packit 062bc7
Show detailed partition information. This option is identical to the 'i'
Packit 062bc7
option on the main menu.
Packit 062bc7

Packit 062bc7
l
Packit 062bc7
Packit 062bc7
Packit 062bc7
Load partition data from a backup file. This option is the reverse of the 'b'
Packit 062bc7
option on the main menu. Note that restoring partition data from anything
Packit 062bc7
but the original disk is not recommended.
Packit 062bc7

Packit 062bc7
m
Packit 062bc7
Packit 062bc7
Packit 062bc7
Return to the main menu. This option enables you to enter main-menu commands.
Packit 062bc7

Packit 062bc7
o
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print protective MBR data. You can see a summary of the protective MBR's
Packit 062bc7
partitions with this option. This may enable you to spot glaring problems
Packit 062bc7
or help identify the partitions in a hybrid MBR.
Packit 062bc7

Packit 062bc7
p
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print the partition table. This option is identical to the 'p' option in
Packit 062bc7
the main menu.
Packit 062bc7

Packit 062bc7
q
Packit 062bc7
Packit 062bc7
Packit 062bc7
Quit without saving changes. This option is identical to the 'q' option in
Packit 062bc7
the main menu.
Packit 062bc7

Packit 062bc7
t
Packit 062bc7
Packit 062bc7
Packit 062bc7
Transform BSD partitions into GPT partitions. This option works on BSD
Packit 062bc7
disklabels held within GPT (or converted MBR) partitions. Converted
Packit 062bc7
partitions' type codes are likely to need manual adjustment. gdisk
Packit 062bc7
will attempt to convert BSD disklabels stored on the main disk when
Packit 062bc7
launched, but this conversion is likely to produce first and/or last
Packit 062bc7
partitions that are unusable. The many BSD variants means that the
Packit 062bc7
probability of gdisk being unable to convert a BSD disklabel is
Packit 062bc7
high compared to the likelihood of problems with an MBR conversion.
Packit 062bc7

Packit 062bc7
v
Packit 062bc7
Packit 062bc7
Packit 062bc7
Verify disk. This option is identical to the 'v' option in the main menu.
Packit 062bc7

Packit 062bc7
w
Packit 062bc7
Packit 062bc7
Packit 062bc7
Write table to disk and exit. This option is identical to the 'w' option in
Packit 062bc7
the main menu.
Packit 062bc7

Packit 062bc7
x
Packit 062bc7
Packit 062bc7
Packit 062bc7
Enter the experts' menu. This option is identical to the 'x' option in the
Packit 062bc7
main menu.
Packit 062bc7

Packit 062bc7
?
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print the menu. This option (or any unrecognized entry) displays a summary
Packit 062bc7
of the menu options.
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7
The third gdisk menu is the experts' menu. This menu provides advanced
Packit 062bc7
options that aren't closely related to recovery or transformation between
Packit 062bc7
partitioning systems. Its options are:
Packit 062bc7

Packit 062bc7
Packit 062bc7
a
Packit 062bc7
Packit 062bc7
Packit 062bc7
Set attributes. GPT provides a 64-bit attributes field that can be used to
Packit 062bc7
set features for each partition. gdisk supports four attributes:
Packit 062bc7
system partition, read-only, hidden, and
Packit 062bc7
do not automount. You can set other attributes, but their numbers
Packit 062bc7
aren't translated into anything useful. In practice, most OSes seem to
Packit 062bc7
ignore these attributes.
Packit 062bc7

Packit 062bc7
c
Packit 062bc7
Packit 062bc7
Packit 062bc7
Change partition GUID. You can enter a custom unique GUID for a partition
Packit 062bc7
using this option. (Note this refers to the GUID that uniquely identifies a
Packit 062bc7
partition, not to its type code, which you can change with the 't' main-menu
Packit 062bc7
option.) Ordinarily, gdisk assigns this number randomly; however,
Packit 062bc7
you might want to adjust the number manually if you've wound up with the
Packit 062bc7
same GUID on two partitions because of buggy GUID assignments (hopefully
Packit 062bc7
not in gdisk) or sheer incredible coincidence.
Packit 062bc7

Packit 062bc7
d
Packit 062bc7
Packit 062bc7
Packit 062bc7
Display the sector alignment value. See the
Packit 062bc7
description of the 'l' option for more details.
Packit 062bc7

Packit 062bc7
e
Packit 062bc7
Packit 062bc7
Packit 062bc7
Move backup GPT data structures to the end of the disk. Use this command if
Packit 062bc7
you've added disks to a RAID array, thus creating a virtual disk with space
Packit 062bc7
that follows the backup GPT data structures. This command moves the backup
Packit 062bc7
GPT data structures to the end of the disk, where they belong.
Packit 062bc7

Packit 062bc7
f
Packit 062bc7
Packit 062bc7
Packit 062bc7
Randomize the disk's GUID and all partitions' unique GUIDs (but not their
Packit 062bc7
partition type code GUIDs). This function may be used after cloning a disk
Packit 062bc7
with another utility in order to render all GUIDs once again unique.
Packit 062bc7

Packit 062bc7
g
Packit 062bc7
Packit 062bc7
Packit 062bc7
Change disk GUID. Each disk has a unique GUID code, which gdisk
Packit 062bc7
assigns randomly upon creation of the GPT data structures. You can generate
Packit 062bc7
a fresh random GUID or enter one manually with this option.
Packit 062bc7

Packit 062bc7
h
Packit 062bc7
Packit 062bc7
Packit 062bc7
Recompute CHS values in protective or hybrid MBR. This option can sometimes
Packit 062bc7
help if a disk utility, OS, or BIOS doesn't like the CHS values used by the
Packit 062bc7
partitions in the protective or hybrid MBR. In particular, the GPT
Packit 062bc7
specification requires a CHS value of 0xFFFFFF for over-8GiB partitions,
Packit 062bc7
but this value is technically illegal by the usual standards. Some BIOSes
Packit 062bc7
hang if they encounter this value. This option will recompute a more normal
Packit 062bc7
CHS value -- 0xFEFFFF for over-8GiB partitions, enabling these BIOSes to
Packit 062bc7
boot.
Packit 062bc7

Packit 062bc7
i
Packit 062bc7
Packit 062bc7
Packit 062bc7
Show detailed partition information. This option is identical to the 'i'
Packit 062bc7
option on the main menu.
Packit 062bc7

Packit 062bc7
j
Packit 062bc7
Packit 062bc7
Packit 062bc7
Adjust the location of the main partition table. This value is normally 2,
Packit 062bc7
but it may need to be increased in some cases, such as when a
Packit 062bc7
system-on-chip (SoC) is hard-coded to read boot code from sector 2. I
Packit 062bc7
recommend against adjusting this value unless doing so is absolutely
Packit 062bc7
necessary.
Packit 062bc7

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

Packit 062bc7
m
Packit 062bc7
Packit 062bc7
Packit 062bc7
Return to the main menu. This option enables you to enter main-menu commands.
Packit 062bc7

Packit 062bc7
n
Packit 062bc7
Packit 062bc7
Packit 062bc7
Create a new protective MBR. Use this option if the current protective MBR
Packit 062bc7
is damaged in a way that gdisk doesn't automatically detect and
Packit 062bc7
correct, or if you want to convert a hybrid MBR into a "pure" GPT with a
Packit 062bc7
conventional protective MBR.
Packit 062bc7

Packit 062bc7
o
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print protective MBR data. You can see a summary of the protective MBR's
Packit 062bc7
partitions with this option. This may enable you to spot glaring problems
Packit 062bc7
or help identify the partitions in a hybrid MBR.
Packit 062bc7

Packit 062bc7
p
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print the partition table. This option is identical to the 'p' option in
Packit 062bc7
the main menu.
Packit 062bc7

Packit 062bc7
q
Packit 062bc7
Packit 062bc7
Packit 062bc7
Quit without saving changes. This option is identical to the 'q' option in
Packit 062bc7
the main menu.
Packit 062bc7

Packit 062bc7
r
Packit 062bc7
Packit 062bc7
Packit 062bc7
Enter the recovery & transformations menu. This option is identical to
Packit 062bc7
the 'r' option on the main menu.
Packit 062bc7

Packit 062bc7
s
Packit 062bc7
Packit 062bc7
Packit 062bc7
Resize partition table. The default partition table size is 128 entries.
Packit 062bc7
Officially, sizes of less than 16KB (128 entries, given the normal entry
Packit 062bc7
size) are unsupported by the GPT specification; however, in practice they
Packit 062bc7
seem to work, and can sometimes be useful in converting MBR disks. Larger
Packit 062bc7
sizes also work fine. OSes may impose their own limits on the number of
Packit 062bc7
partitions, though.
Packit 062bc7

Packit 062bc7
t
Packit 062bc7
Packit 062bc7
Packit 062bc7
Swap two partitions' entries in the partition table. One partition may be
Packit 062bc7
empty. For instance, if partitions 1-4 are defined, transposing 1 and 5
Packit 062bc7
results in a table with partitions numbered from 2-5. Transposing
Packit 062bc7
partitions in this way has no effect on their disk space allocation; it
Packit 062bc7
only alters their order in the partition table.
Packit 062bc7

Packit 062bc7
u
Packit 062bc7
Packit 062bc7
Packit 062bc7
Replicate the current device's partition table on another device. You will
Packit 062bc7
be prompted to type the new device's filename. After the write operation
Packit 062bc7
completes, you can continue editing the original device's partition table.
Packit 062bc7
Note that the replicated partition table is an exact copy, including all
Packit 062bc7
GUIDs; if the device should have its own unique GUIDs, you should use the
Packit 062bc7
f option on the new disk.
Packit 062bc7

Packit 062bc7
v
Packit 062bc7
Packit 062bc7
Packit 062bc7
Verify disk. This option is identical to the 'v' option in the main menu.
Packit 062bc7

Packit 062bc7
z
Packit 062bc7
Packit 062bc7
Packit 062bc7
Zap (destroy) the GPT data structures and exit. Use this option if you want to
Packit 062bc7
repartition a GPT disk using fdisk or some other GPT-unaware program.
Packit 062bc7
You'll be given the choice of preserving the existing MBR, in case it's a
Packit 062bc7
hybrid MBR with salvageable partitions or if you've already created new MBR
Packit 062bc7
partitions and want to erase the remnants of your GPT partitions. If you've
Packit 062bc7
already created new MBR partitions, it's conceivable that this option will
Packit 062bc7
damage the first and/or last MBR partitions! Such an event is unlikely, but
Packit 062bc7
could occur if your new MBR partitions overlap the old GPT data structures.
Packit 062bc7

Packit 062bc7
?
Packit 062bc7
Packit 062bc7
Packit 062bc7
Print the menu. This option (or any unrecognized entry) displays a summary
Packit 062bc7
of the menu options.
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7
In many cases, you can press the Enter key to select a default option when
Packit 062bc7
entering data. When only one option is possible, gdisk
Packit 062bc7
usually bypasses the prompt entirely.
Packit 062bc7

Packit 062bc7
 
Packit 062bc7

BUGS

Packit 062bc7
Packit 062bc7
Known bugs and limitations include:
Packit 062bc7

Packit 062bc7
Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
The program compiles correctly only on Linux, FreeBSD, Mac OS X, and Windows.
Packit 062bc7
Linux versions for x86-64 (64-bit), x86 (32-bit), and PowerPC (32-bit) have been
Packit 062bc7
tested, with the x86-64 version having seen the most testing. Under FreeBSD,
Packit 062bc7
32-bit (x86) and 64-bit (x86-64) versions have been tested. Only 32-bit
Packit 062bc7
versions for Mac OS X and Windows have been tested by the author, although
Packit 062bc7
I've heard of 64-bit versions being successfully compiled.
Packit 062bc7

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

Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
The fields used to display the start and end sector numbers for partitions
Packit 062bc7
in the 'p' command are 14 characters wide. This translates to a limitation
Packit 062bc7
of about 45 PiB. On larger disks, the displayed columns will go out of
Packit 062bc7
alignment.
Packit 062bc7

Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
In the Windows version, only ASCII characters are supported in the
Packit 062bc7
partition name field. If an existing partition uses non-ASCII UTF-16
Packit 062bc7
characters, they're likely to be corrupted in the 'i' and 'p' menu options'
Packit 062bc7
displays; however, they should be preserved when loading and saving
Packit 062bc7
partitions. Binaries for Linux, FreeBSD, and OS X support full UTF-16
Packit 062bc7
partition names.
Packit 062bc7

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

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

Packit 062bc7
*
Packit 062bc7
Packit 062bc7
Packit 062bc7
MBR conversions work only if the disk has correct LBA partition
Packit 062bc7
descriptors. These descriptors should be present on any disk over 8 GiB in
Packit 062bc7
size or on smaller disks partitioned with any but very ancient software.
Packit 062bc7

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

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

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

Packit 062bc7
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
 
Packit 062bc7

AUTHORS

Packit 062bc7
Packit 062bc7
Primary author: Roderick W. Smith (rodsmith@rodsbooks.com)
Packit 062bc7

Packit 062bc7
Contributors:
Packit 062bc7

Packit 062bc7
* Yves Blusseau (1otnwmz02@sneakemail.com)
Packit 062bc7

Packit 062bc7
* David Hubbard (david.c.hubbard@gmail.com)
Packit 062bc7

Packit 062bc7
* Justin Maggard (justin.maggard@netgear.com)
Packit 062bc7

Packit 062bc7
* Dwight Schauer (dschauer@gmail.com)
Packit 062bc7

Packit 062bc7
* Florian Zumbiehl (florz@florz.de)
Packit 062bc7

Packit 062bc7

Packit 062bc7
 
Packit 062bc7

SEE ALSO

Packit 062bc7
Packit 062bc7
cfdisk (8),
Packit 062bc7
cgdisk (8),
Packit 062bc7
fdisk (8),
Packit 062bc7
mkfs (8),
Packit 062bc7
parted (8),
Packit 062bc7
sfdisk (8)
Packit 062bc7
sgdisk (8)
Packit 062bc7
fixparts (8)
Packit 062bc7

Packit 062bc7
http://en.wikipedia.org/wiki/GUID_Partition_Table
Packit 062bc7

Packit 062bc7
http://developer.apple.com/technotes/tn2006/tn2166.html
Packit 062bc7

Packit 062bc7
http://www.rodsbooks.com/gdisk/
Packit 062bc7

Packit 062bc7
 
Packit 062bc7

AVAILABILITY

Packit 062bc7
Packit 062bc7
The gdisk command is part of the GPT fdisk package and is
Packit 062bc7
available from Rod Smith.
Packit 062bc7

Packit 062bc7
Packit 062bc7

Packit 062bc7
 

Index

Packit 062bc7
Packit 062bc7
NAME
Packit 062bc7
SYNOPSIS
Packit 062bc7
DESCRIPTION
Packit 062bc7
OPTIONS
Packit 062bc7
BUGS
Packit 062bc7
AUTHORS
Packit 062bc7
SEE ALSO
Packit 062bc7
AVAILABILITY
Packit 062bc7
Packit 062bc7

Packit 062bc7
This document was created by
Packit 062bc7
man2html,
Packit 062bc7
using the manual pages.
Packit 062bc7
Time: 01:41:20 GMT, July 28, 2017
Packit 062bc7
</BODY>
Packit 062bc7
</HTML>