LinuxCommandLibrary

gdisk

Manage GPT (GUID Partition Table) disks

SYNOPSIS

gdisk disk_device

PARAMETERS

disk_device
    The device name of the disk to be partitioned (e.g., /dev/sda, /dev/nvme0n1).

DESCRIPTION

gdisk (GPT fdisk) is a powerful command-line tool for partitioning disks using the GUID Partition Table (GPT) scheme. It's an alternative to fdisk for larger disks (exceeding 2TB) and modern systems using UEFI. gdisk provides an interactive interface for creating, deleting, modifying, and viewing partitions. It supports a variety of partition types and allows fine-grained control over partition attributes, including setting bootable flags and specifying partition names. Unlike older tools that manipulate the MBR (Master Boot Record), gdisk works with GPT, which offers greater flexibility and overcomes the limitations of the MBR format. gdisk is designed for advanced users comfortable with partitioning concepts. It also includes recovery options for damaged partition tables. Improper use can lead to data loss, so understanding GPT concepts is essential.

INTERACTIVE COMMANDS

gdisk presents an interactive command-line interface after invocation. Common commands include:
p: Print the partition table.
n: Create a new partition.
d: Delete a partition.
t: Change a partition's type code.
w: Write changes to disk and exit.
q: Quit without saving changes.
v: Verify disk

BACKUP GPT DATA

gdisk automatically makes backups of the GPT data in a secondary header, which is found at the end of the storage, and a backup partition table. Backups can be useful when the primary GPT data becomes corrupted or damaged.

RECOVERY OPTIONS

If GPT data is damaged, gdisk offers recovery options. If the primary GPT header is damaged, gdisk uses the secondary GPT header to recover the partition table.

SEE ALSO

fdisk(8), parted(8), sgdisk(8)

Copied to clipboard