First, open the parted
command prompt by specifying the block device:
sudo parted /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01
This brings you to a prompt that begins with (parted)
where you can run parted
commands on that block device without having to specify the path again.
Write a bare GPT partition table to your volume:
Next, you can write your GPT partitions with mkpart <partlabel> <start> <end>
:
-
partlabel
is the name of the partition entry. Choose a name or omit the name by using an empty string (""
).
-
start
and end
are the start and end positions of the partition. These support a variety of units, but we recommend using percentages to let parted
align the partitions to the underlying sectors for the best performance.
For example, mkpart "" 0% 100%
creates a single partition with no partition label that spans the entire volume.
Similarly, mkpart example1 0% 50%
and mkpart example2 50% 100%
create two equally-sized partitions labeled “example1” and “example2”.
To start, use the volume identifier as an argument to gdisk
to scan the device and locate existing structures.
sudo gdisk /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01
This enters you into an interactive prompt:
Output
GPT fdisk (gdisk) version 1.0.1
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help):
To write a new partition table to the disk, use the o option:
Confirm the operation by entering y at the confirmation prompt:
Output
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N):
Next, create partitions by using the n option:
gdisk
takes you through a series of prompts for the partition number, the first sector, the last sector or size, and the GUID for the partition type:
Output
Partition number (1-128, default 1):
First sector (34-209715166, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-209715166, default = 209715166) or {+-}size{KMGTP}: +10G
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'
You can press ENTER
to accept the suggested default values, which is typically the right choice. For the last sector or size prompt, you can use +
to indicate relative sizing. This means that you can pass the partition size directly (instead of calculating the end position, as with parted
).
You can display the partitions by using the p option:
Output
Disk /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01: 209715200 sectors, 100.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 19252774-25E2-4899-96CD-DCFE3B846DCC
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 209715166
Partitions will be aligned on 2048-sector boundaries
Total free space is 188743613 sectors (90.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 2048 20973567 10.0 GiB 8300 Linux filesystem
To write the table to the volume and exit the utility, use the w option, which prompts you to confirm the changes.
Output
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N):
When you are certain of your changes, type Y to write the partitions to the volume.