Note: from a personal point-of-view, I use gdisk
over parted
; gdisk
lets you examine changes more closely, while parted
commands will often not ask for prompts.
Syntax:
parted [options] [device [command [options …] …]
Options:
Commands:
start
and ending at end
. Default unit is megabytes.
Display the partition table of /dev/sdc
:
parted /dev/sdc print
Create a new, empty partition table on a device with GPT. Note that this will remove all existing partitions.
parted /dev/sdc mklabel gpt
Sample walkthrough
Final format: 1 MB boot partition used by GRUB, a 128 MB partition for the kernel and GRUB2 cnofig, mounted by OS as /boot
, a 2 GB swap partition, and the remaining space for the root partition, mounted at /
.
Wipe the partition table, create a 2MB primary partition used by GRUB2 (not /boot), starting at the 1st MB and ending at the 2nd, name it grub
, and set the bios_grub
label on:
parted /dev/sdc mklabel gpt parted /dev/sdc mkpart primary 1 3 unit MB name 1 grub set 1 bios_grub on parted /dev/sdc mkpart primary 3 131 name 2 boot parted /dev/sdc mkpart primary 131 2179 name 3 swap