Naming Conventions for DigitalOcean Volumes

Block storage volumes are network-based block devices that provide additional data storage for Droplets. You can move them between Droplets and resize them at any time.

DigitalOcean volumes have some platform-specific naming conventions for volume device files, automatic mount points, and systemd unit files:

Volume Name /dev/disk/by-id Link Automatic Mount Point Mount Unit File in /etc/systemd/system
example scsi-0DO_Volume_example /mnt/example mnt-example.mount
volume-nyc1-01 scsi-0DO_Volume_volume-nyc-01 /mnt/volume_nyc_01 mnt-volume_nyc_01.mount

Each section below goes into more detail about these naming conventions.

Volume Identifiers

In Linux, hardware devices are typically represented by special device files within the /dev directory with names like sda and sdb. Subdirectories in /dev/disk contain symbolic links with more descriptive names to make it easier to identify devices.

/dev/sd* names can change between boots, so we recommend using the links in /dev/disk/by-id for DigitalOcean volumes (and any partitions on them) because they are predictable and reliable across reboots.

Volume Name Identiifer
example /dev/disk/by-id/scsi-0DO_Volume_example
volume-nyc1-01 /dev/disk/by-id/scsi-0DO_Volume_volume-nyc-01

/dev/disk/by-id Format for DigitalOcean Volumes

Links in the /dev/disk/by-id subdirectory are conventionally associated with hardware serial numbers, but the /dev/disk/by-id identifiers for DigitalOcean volumes are composed of these parts in order:

  1. The string scsi-0DO_Volume_
  2. The name of the volume, like volume-nyc1-01
  3. The partition suffix, like -part1, if the volume is partitioned

The full identifier for a volume named volume-nyc1-01 would be /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01. The first partition on that volume would be /dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1.

You can use mkfs’s -L option to label a filesystem. These labels are persistent names that can be easier to remember as an alternative to the /dev/disk/by-id links.

Most tools can take /dev/disk/by-id identifers as input, but will use the traditional /dev/sd* names in their output.

To see the mapping between /dev/disk/by-id links and /dev/sd* names, read the link targets with file:

file /dev/disk/by-id/*
/dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01:       symbolic link to ../../sda
/dev/disk/by-id/scsi-0DO_Volume_volume-nyc1-01-part1: symbolic link to ../../sda1

Automatic Mounting

Volume Name Automatic Mount Point Mount Unit File
example /mnt/example /etc/systemd/system/mnt-example.mount
volume-nyc1-01 /mnt/volume_nyc_01 /etc/systemd/system/mnt-volume_nyc_01.mount

Unit Files

When you create a new volume, you can automatically format and mount it to Droplets with supported operating systems. Automatic mounting uses systemd on distributions that support it.

The systemd mount unit files are named /etc/systemd/system/path-to-mount-point.mount. The path to the mount point uses hyphens as separators instead of forward slashes.

Mount Points

We automatically mount volumes to /mnt in a directory with the same name as the volume, so a volume named example would have the mount point /mnt/example.

However, because of the systemd mount unit file naming, we cannot automatically mount a volume at a path that includes hyphens. If there are hyphens in the volume name, we replace the hyphens with underscores, so a volume named volume-nyc-01 would have the mount point /mnt/volume_nyc_01.

For consistency, we match this behavior even on distributions without systemd.