Skip to content

Instantly share code, notes, and snippets.

@noslin005
Last active August 24, 2021 13:04
Show Gist options
  • Save noslin005/887ad5137b89ec68a87d4622699280b3 to your computer and use it in GitHub Desktop.
Save noslin005/887ad5137b89ec68a87d4622699280b3 to your computer and use it in GitHub Desktop.
Create partition with sgdisk

Create Partition Legacy Boot

sgdisk -n 0:0:+1MiB -t 0:ef02 -c 0:grub /dev/sda
sgdisk -n 0:0:+1GiB -t 0:ea00 -c 0:boot /dev/sda
sgdisk -n 0:0:+4GiB -t 0:8200 -c 0:swap /dev/sda
sgdisk -n 0:0:+50GiB -t 0:8300 -c 0:root /dev/sda
sgdisk -n 0:0:0 -t 0:8300 -c 0:home /dev/sda

Create EFI BOOT Partition Scheme

sgdisk -n 0:0:+512MiB -t 0:ef00 -c 0:efi /dev/sda
sgdisk -n 0:0:+1GiB -t 0:ea00 -c 0:boot /dev/sda
sgdisk -n 0:0:+8GiB -t 0:8200 -c 0:swap /dev/sda
sgdisk -n 0:0:+50GiB -t 0:8300 -c 0:root /dev/sda
sgdisk -n 0:0:0 -t 0:8300 -c 0:home /dev/sda

Copy Partition Table

sgdisk --backup=table /dev/sdX
sgdisk --load-backup=table /dev/sdY
sgdisk -G /dev/sdY

# OR

sgdisk /dev/sdX -R /dev/sdY # Copy from sdX to sdY
sgdisk -G /dev/sdY # randomize GUID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment