gparted
# interactive mode
parted "/dev/sda"
# list partition layout for all devices
parted -l
print
# print partition table and partition numbers
parted "/dev/sda" print
resizepart
# resize a partition
parted "/dev/sda" resizepart
mklabel
# GPT
parted "/dev/sda" -- \
mklabel "gpt"
# MSDOS (MBR)
parted "/dev/sda" -- \
mklabel "msdos"
mkpart
# root partition (GPT)
parted /dev/sda -- \
mkpart root ext4 512MB -8GB
# root partition (MBR)
parted "/dev/sda" -- \
mkpart primary 512MB -8GB
parted /dev/sda -- set 1 boot on
# swap partition (GPT)
parted /dev/sda -- \
mkpart swap linux-swap -8GB 100%
# swap partition (MBR)
parted "/dev/sda" -- \
mkpart primary linux-swap -8GB 100%
# boot partition
parted "/dev/sda" -- \
mkpart ESP fat32 1MB 512MB
parted "/dev/sda" -- \
set 3 esp on
set
# set partition 1 as the boot partition
parted "/dev/sda" -- \
set 1 boot on
# set partition 3 as the esp partition
parted "/dev/sda" -- \
set 3 esp on