sgdisk
Manage GUID Partition Tables (GPT). Part of the GPT fdisk suite; designed for scripting and automation.
More info →Options (8)
-p, --printbooleanDisplay basic GPT partition summary data for a device
sudo sgdisk {{[-p|--print]}} {{/dev/sdX}}-Z, --zap-allbooleanWipe both GPT and MBR data structures from a device (destroys all partition information)
sudo sgdisk {{[-Z|--zap-all]}} {{/dev/sdX}}-m, --gpttombrbooleanConvert a GPT disk to MBR format using up to four partitions
sudo sgdisk {{[-m|--gpttombr]}} {{1:2:3:4}} {{/dev/sdX}}-d, --deletebooleanDelete a partition entry by number (data in sectors remains untouched)
sudo sgdisk {{[-d|--delete]}} {{1}} {{/dev/sdX}}-b, --backupbooleanSave the current in-memory GPT data (protective MBR, headers, and table) to a binary backup file
sudo sgdisk {{[-b|--backup]}} {{/path/to/backup.gpt}} {{/dev/sdX}}-l, --load-backupbooleanLoad GPT data from a backup file (restoring from a non-original disk is not recommended)
sudo sgdisk {{[-l|--load-backup]}} {{/path/to/backup.gpt}} {{/dev/sdX}}-v, --verifybooleanVerify GPT structures for CRC errors, mismatches, or inconsistencies
sudo sgdisk {{[-v|--verify]}} {{/dev/sdX}}-L, --list-typesbooleanDisplay a summary of available partition type codes (no device required)
sgdisk {{[-L|--list-types]}}Examples (8)
Wipe both GPT and MBR data structures from a device (destroys all partition information)
Convert a GPT disk to MBR format using up to four partitions
Delete a partition entry by number (data in sectors remains untouched)
Save the current in-memory GPT data (protective MBR, headers, and table) to a binary backup file
Load GPT data from a backup file (restoring from a non-original disk is not recommended)
Verify GPT structures for CRC errors, mismatches, or inconsistencies
Display a summary of available partition type codes (no device required)
sgdisk [-L|--list-types]