sgdisk
Manage GUID Partition Tables (GPT). tldr-pages
On several platforms
Several platforms
Manage GUID Partition Tables (GPT). Part of the GPT fdisk suite; designed for scripting and automation.
Display basic GPT partition summary data for a device
sudo sgdisk --print /dev/sdXIdentifyWipe both GPT and MBR data structures from a device (destroys all partition information)
sudo sgdisk --zap-all /dev/sdXIdentifyConvert a GPT disk to MBR format using up to four partitions
sudo sgdisk --gpttombr 1:2:3:4 /dev/sdXIdentifyDelete a partition entry by number (data in sectors remains untouched)
sudo sgdisk --delete 1 /dev/sdXIdentifySave the current in-memory GPT data (protective MBR, headers, and table) to a binary backup file
sudo sgdisk --backup /path/to/backup.gpt /dev/sdXIdentifyLoad GPT data from a backup file (restoring from a non-original disk is not recommended)
sudo sgdisk --load-backup /path/to/backup.gpt /dev/sdXIdentifyVerify GPT structures for CRC errors, mismatches, or inconsistencies
sudo sgdisk --verify /dev/sdXIdentifyDisplay a summary of available partition type codes (no device required)
sgdisk --list-typesIdentify