OS Manuals

/usr/bin/sgdisk

Script friendly partitioning tool for Globally Unique Identifier (GUID) Partition Table (GPT) disks

From sgdisk 1.0.10-r9 (os), captured 2026-11-05 by running sgdisk --help (exit 0). permalink

Usage: sgdisk  [OPTION...] <device>
  -A, --attributes=list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]     operate on partition attributes
  -a, --set-alignment=value                                                                       set sector alignment
  -b, --backup=file                                                                               backup GPT to file
  -B, --byte-swap-name=partnum                                                                    byte-swap partition's name
  -c, --change-name=partnum:name                                                                  change partition's name
  -C, --recompute-chs                                                                             recompute CHS values in protective/hybrid MBR
  -d, --delete=partnum                                                                            delete a partition
  -D, --display-alignment                                                                         show number of sectors per allocation block
  -e, --move-second-header                                                                        move second/backup header to end of disk
  -E, --end-of-largest                                                                            show end of largest free block
  -f, --first-in-largest                                                                          show start of the largest free block
  -F, --first-aligned-in-largest                                                                  show start of the largest free block, aligned
  -g, --mbrtogpt                                                                                  convert MBR to GPT
  -G, --randomize-guids                                                                           randomize disk and partition GUIDs
  -h, --hybrid=partnum[:partnum...][:EE]                                                          create hybrid MBR
  -i, --info=partnum                                                                              show detailed information on partition
  -I, --align-end                                                                                 align partition end points
  -j, --move-main-table=sector                                                                    change the start sector of the main partition table
  -k, --move-backup-table=sector                                                                  change the start sector of the second/backup partition table
  -l, --load-backup=file                                                                          load GPT backup from file
  -L, --list-types                                                                                list known partition types
  -m, --gpttombr=partnum[:partnum...]                                                             convert GPT to MBR
  -n, --new=partnum:start:end                                                                     create new partition
  -N, --largest-new=partnum                                                                       create largest possible new partition
  -o, --clear                                                                                     clear partition table
  -O, --print-mbr                                                                                 print MBR partition table
  -p, --print                                                                                     print partition table
  -P, --pretend                                                                                   make changes in memory, but don't write them
  -r, --transpose=partnum:partnum                                                                 transpose two partitions
  -R, --replicate=device_filename                                                                 replicate partition table
  -s, --sort                                                                                      sort partition table entries
  -S, --resize-table=numparts                                                                     resize partition table
  -t, --typecode=partnum:{hexcode|GUID}                                                           change partition type code
  -T, --transform-bsd=partnum                                                                     transform BSD disklabel partition to GPT
  -u, --partition-guid=partnum:guid                                                               set partition GUID
  -U, --disk-guid=guid                                                                            set disk GUID
  -v, --verify                                                                                    check partition table integrity
  -V, --version                                                                                   display version information
  -z, --zap                                                                                       zap (destroy) GPT (but not MBR) data structures
  -Z, --zap-all                                                                                   zap (destroy) GPT and MBR data structures

Help options:
  -?, --help                                                                                      Show this help message
      --usage                                                                                     Display brief usage message
Options (42)
OptionDescriptionSource
-A, --attributesoperate on partition attributeshelp
-a, --set-alignment valueSet the sector alignment multiple.help + man
-b, --backup fileSave partition data to a backup file.help + man
-B, --byte-swap-name partnumSwap the byte order for the name of the specified partition.help + man
-c, --change-name partnum:nameChange the GPT name of a partition.help + man
-C, --recompute-chsRecompute CHS values in protective or hybrid MBR.help + man
-d, --delete partnumDelete a partition.help + man
-D, --display-alignmentshow number of sectors per allocation blockhelp + man
-e, --move-second-headerMove backup GPT data structures to the end of the disk.help + man
-E, --end-of-largestDisplays the sector number of the end of the largest available block of sectors on the disk.help + man
-f, --first-in-largestDisplays the sector number of the start of the largest available block of sectors on the disk.help + man
-F, --first-aligned-in-largestSimilar to -f (--first-in-largest), except returns the sector number with the current alignment correction applied.help + man
-g, --mbrtogptConvert an MBR or BSD disklabel disk to a GPT disk.help + man
-G, --randomize-guidsRandomize the disk's GUID and all partitions' unique GUIDs (but not their partition type code GUIDs).help + man
-h, --hybrid partnum[:partnum...][:EECreate a hybrid MBR.help + man
-i, --info partnumshow detailed information on partitionhelp + man
-I, --align-endWhen possible, align the end points of partitions to one less than a multiple of the alignment value.help + man
-j, --move-main-table sectorchange the start sector of the main partition tablehelp + man
-k, --move-backup-table sectorchange the start sector of the second/backup partition tablehelp + man
-l, --load-backup fileLoad partition data from a backup file.help + man
-L, --list-typesDisplay a summary of partition types.help + man
-m, --gpttombr partnum[:partnum...Convert disk from GPT to MBR form.help + man
-n, --new partnum:start:endCreate a new partition.help + man
-N, --largest-new partnumCreate a new partition that fills the largest available block of space on the disk.help + man
-o, --clearClear out all partition data.help + man
-O, --print-mbrDisplay basic MBR partition summary data.help + man
-p, --printDisplay basic GPT partition summary data.help + man
-P, --pretendmake changes in memory, but don't write themhelp + man
-r, --transpose partnum:partnumSwap two partitions' entries in the partition table.help + man
-R, --replicate device_filenameReplicate the main device's partition table on the specified second device.help + man
-s, --sortsort partition table entrieshelp + man
-S, --resize-table numpartsresize partition tablehelp
-t, --typecode partnum:{hexcode|GUIDChange a single partition's type code.help + man
-T, --transform-bsd partnumTransform BSD partitions into GPT partitions.help + man
-u, --partition-guid partnum:guidSet the partition unique GUID for an individual partition.help + man
-U, --disk-guid guidSet the GUID for the disk.help + man
-v, --verifycheck partition table integrityhelp + man
-V, --versionDisplay program version information.help + man
-z, --zapZap (destroy) the GPT data structures and then exit.help + man
-Z, --zap-allZap (destroy) the GPT and MBR data structures and then exit.help + man
-?, --helpPrint a summary of options.help + man
--usagePrint a brief summary of available options.help + man
Exit status (7) from the manual page
0Normal program execution
1Too few arguments
2An error occurred while reading the partition table
3Non-GPT disk detected and no -g option, but operation requires a write action
4An error prevented saving changes
5An error occurred while reading standard input (should never occur with sgdisk, but may with gdisk)
8Disk replication operation (-R) failed

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.