Skip to main content

Partitioning disks

Find out how to partition disks on the centron and ccloud³, create GPT partition tables and format partitions correctly using ext4.

Partitioning

Partitioning allows you to divide a single storage device into smaller units that you can manage independently. You can create multiple file systems on a single device to segment the storage space according to functional criteria.

To use partitions with a volume, you must first create the partition(s) and then format each partition.

Creating partitions

The two most common partitioning schemes are the traditional Master Boot Record (MBR) format and the more modern GUID Partition Table (GPT). The MBR format has a number of inherent limitations, particularly regarding the number and size of the partitions you can create.

Unless you have any specific requirements, we recommend using GPT partitions. When working with GPT partitions, we recommend parted for non-interactive partitioning and gdisk for interactive partitioning.

Non-interactive partitioning with parted

First, write an empty GPT partition table to your volume by passing the device to the parted command using the mklabel gpt subcommand:

sudo parted /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01 mklabel gpt

Creating partitions

For example, this command creates a single partition that spans the entire volume:

sudo parted -a opt /dev/disk/by-id/scsi-example mkpart primary 0% 100%

Formatting partitions

Once you have partitioned the drive, you must format the partitions by assigning a file system to each one.

Formatting with ext4

To format a partition with an ext4 file system, use mkfs.ext4:

bashCopy codesudo mkfs.ext4 /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1

Once you have formatted each partition, you are ready to mount the volume and start using it.