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.
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.
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.
/dev/disk/by-id
LinksLinks 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:
scsi-0DO_Volume_
volume-nyc1-01
-part1
, if the volume is partitionedThe 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
.
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.The /dev/disk/by-id
link for a volume is visible in its config instructions in the control panel (click on the volume’s More menu, then Config instructions).
/dev/disk/by-id
links to /dev/sd*
NamesMost tools can take /dev/disk/by-id
identifiers as input but 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
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 |
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.
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.