How to Create Partitions on DigitalOcean Volumes Block Storage

Validated on 20 Jun 2025 • Last edited on 20 Jun 2025

Volumes are network-based block devices that provide additional data storage for Droplets. You can move them between Droplets, create disk images of them, and resize them at any time.

Partitioning lets you divide a single storage device into smaller units that you can manage independently. You can write multiple filesystems to one device to segment space along functional lines.

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

Create Partitions

The two most common partitioning systems are the legacy master boot record (MBR) and the contemporary GUID Partition Table (GPT).

MBR partitions have significant limitations, like restrictions on the number and size of partitions you can create. As a result, most contemporary computers use GPT, which also provides limited backwards compatibility support for MBRs.

We recommend only using GPT partitions. To work with GPT partitions, we recommend using parted for non-interactive partitioning or gdisk for interactive, menu-based partitioning. Both parted and gdisk are installed by default on most Linux distributions.

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:

mklabel gpt

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:

o

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:

n

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:

p
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.

w
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.

Format the Partitions

After partitioning, you must format the partitions by writing a filesystem to each one. The filesystem is responsible for managing file-level interactions and providing reliable methods of writing and retrieving information on the disk.

There are many different types of Linux-compatible filesystems, like ext4, XFS, Btrfs, and ZFS. Distributions usually promote ext4 or XFS as the default choice for general purpose computing. The tooling for these two filesystems is usually installed by default, which means that formatting and managing these filesystems is straightforward.

Most Linux filesystems are formatted using tools that begin with mkfs. followed by the name of the filesystem in lowercase, like mkfs.ext4 or mkfs.xfs. By default, this creates a filesystem that fills the entire block device passed to it.

Warning

When formatting with mkfs, use the identifier for the partition, not the identifier for the whole volume. Formatting the volume overwrites the partitions you created.

When using the /dev/disk/by-id identifiers, partitions end in -part#. You can use mkfs’s -L option to label the partition, which gives it a persistent name to use as an alternative to the /dev/disk/by-id identifiers.

To format a partition with an ext4 filesystem, use mkfs.ext4 on the partition (not the whole volume):

sudo mkfs.ext4 /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1
Output
mke2fs 1.42.13 (17-May-2015)
Discarding device blocks: done
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: 37858ba9-c2f3-4afe-9013-83111111e862
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

To format a partition with an XFS partition, use mkfs.xfs on the partition (not the whole volume):

sudo mkfs.xfs /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1
Output
meta-data=/dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1 isize=512    agcount=4, agsize=5898175 blks
        =                       sectsz=512   attr=2, projid32bit=1
        =                       crc=1        finobt=1, sparse=0
data     =                       bsize=4096   blocks=23592699, imaxpct=25
        =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=11519, version=2
        =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

Once you’ve formatted each partition, you can mount the volume and begin using it.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.