Skip to content

Instantly share code, notes, and snippets.

@briceburg
Last active August 5, 2021 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briceburg/dedfccff6b6f855aede703e7f6619e97 to your computer and use it in GitHub Desktop.
Save briceburg/dedfccff6b6f855aede703e7f6619e97 to your computer and use it in GitHub Desktop.
convert Ubuntu AMI from MBR partitioning to GPT partitioning
// the following assumes AWS nitro (e.g. t3.*, m5.*, &c) instances (which use /dev/nvme0n1 as root disk)
// "safely" switches from MBR to GPT partitioning in Ubuntu < 21.04 or other AMIS.
// Tested using gdisk 1.0.3 from 18.04 / Bionic.
// after the change, you can use >2TB root disks. either initially, or by resizing a smaller one -- in nitro and non-nitro types
provisioners: [
{
"type": "shell",
"inline": [
"echo Converting to GPT - AWS nitro type instance",
"sudo sgdisk /dev/nvme0n1 --mbrtogpt --new=2:34:2047 --typecode=2:ef02",
"sudo partprobe",
"sudo grub-install /dev/nvme0n1"
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment