As with Fdisk creating an MBR partition, Sgdisk is a tool to create a GPT partition, and if you do not yet understand the GPT partition, refer to the difference between booting MBR and GPT with GRUB.
View all GPT partitions
# sgdisk -p /dev/sdbDisk /dev/sdb: 16780288 sectors, 8.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): 4D5B29E8-6E0B-45DA-8E52-A21910E74479Partition table holds up to 128 entriesFirst usable sector is 34, last usable sector is 16780254Partitions will be aligned on 2048-sector boundariesTotal free space is 4061 sectors (2.0 MiB)Number Start (sector) End (sector) Size Code Name 1 10487808 16780254 3.0 GiB FFFF ceph data 2 2048 10485760 5.0 GiB FFFF ceph journal
To view detailed information for a partition
#/usr/sbin/sgdisk --info=1 /dev/sdbPartition GUID code: 89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE (Unknown)Partition unique GUID: C8D04950-18E6-4102-A867-B874CF94EA74First sector: 10487808 (at 5.0 GiB)Last sector: 16780254 (at 8.0 GiB)Partition size: 6292447 sectors (3.0 GiB)Attribute flags: 0000000000000000Partition name: ‘ceph data‘
Delete all partitions
# sgdisk --zap-all --clear --mbrtogpt /dev/sdbGPT data structures destroyed! You may now partition the disk using fdisk orother utilities.The operation has completed successfully.
Creating partitions
Create partition 2, sector from 2048 to 10485760,type code 8300.
# sgdisk-n 2:2048:10485760-t 2:8300-p/dev/sdbdisk/dev/sdb:16780288 sectors, 8.0 giblogical sector size:512 BytesDis K identifier (GUID): 5888a491-1245-4b40-8aea-a6aeb2c302bbpartition table holds up to entriesfirst usable sector is 34, Last usable sector is 16780254Partitions would be aligned on 2048-sector boundariestotal free space is 6296508 sectors (3. 0 Gib) Number Start (sector) End (sector) Size Code Name 2 2048 10485760 5.0 GiB 8300 Warning:the kernel is still using the old partition table. The new table is used at the next reboot. The operation has completed successfully.# sgdisk-n 1:2048-t 1:8300-p/dev/sdbdisk/dev/sdb:7813837232 sectors, 3.6 Ti Blogical sector size:512 bytesdisk Identifier (GUID): 361860d7-33f5-45e6-9a86-406fe19b1c36partition table holds up to 128 Entriesfirst usable sector is-usable sector is 7813837198Partitions would be aligned on 2048-sector Boundariestot Al free space is 4294969310 sectors (2.0 TiB) Number Start (sector) End (sector) Size Code Name 1 2048 3518869902 1.6 TiB 8300 The operation has completed successfully.
Delete the specified partition
Delete Partition 2.
# sgdisk --delete=2 /dev/sdbWarning: The kernel is still using the old partition table.The new table will be used at the next reboot.The operation has completed successfully.
Sgdisk Common operations