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.
When you first create a new volume, you format it and mount it to use it with a Droplet. You can format and mount volumes automatically at creation time for Droplets with supported operating systems.
Formatting a volume creates a filesystem on the volume, erasing any existing data. You only need to format a volume once when you first create it because new volumes don't have a filesystem.
Mounting a formatted volume adds its filesystem to the Droplet's existing file hierarchy. You need to mount a volume every time you attach it to a Droplet to make it accessible to that Droplet's operating system. You can also set up persistent mounting to tell the operating system to mount certain filesystems on boot, which lets volumes remain accessible after reboots.
To mount a formatted volume, first choose a mount point, which is the directory where the volume's filesystem should be attached. This is where you access the volume's files after it's mounted.
We recommend creating a new directory in
/mnt to use as a mount point:
sudo mkdir /mnt/example_mount_point
mount to mount the volume's filesystem to the mount point. We recommend using the same options as automatic mounting, which are
sudo mount -o defaults,nofail,discard,noatime /dev/disk/by-id/scsi-example /mnt/example_mount_point
These options include read/write access, executing programs, error suppression for nonexistent devices, and continuous TRIM.
mount's man page (
man mount) explains these and all other mount options in detail.
You can check that the mount itself was successful by passing the mount point to
You should see output indicating that it is currently mounted:
TARGET SOURCE FSTYPE OPTIONS /mnt/example_mount_point /dev/sda1 ext4 rw,noatime,discard,data=ordered
/etc/fstab file contains static information about filesystems that the operating system can mount, including which ones to mount automatically at boot. You can add a line to this file for the volume's filesystem to make it mount automatically when the Droplet boots. This keeps the volume's filesystem persistent through reboots.
Each line in
/etc/fstab represents one filesystem and consists of six space-separated fields:
fs_spec, the block device to mount. Use the
/dev/disk/by-id identifier for the volume or partition.
fs_file, the mount point for the filesystem.
fs_vfstype, the type of filesystem in lowercase, like
fs_mntops, the mount options. We recommend the same options as automatic mounting,
nofail in particular lets the OS continue its boot sequence if the filesystem can't be found, which is helpful if you detach the volume in the future without removing its
dump should operate on the filesystem. Use 0 to disable this functionality unless you know you need it.
fs_passno, the order that
fsck should check filesystems in. Use
2 to enable checking. The root filesystem should be
0 disables checking.
Ultimately, the line you add to
/etc/fstab should look like this, with your volume's identifier and mount point:
/dev/disk/by-id/scsi-example /mnt/example-mount-point ext4 defaults,nofail,discard,noatime 0 2
After you edit the file, check that
/etc/fstab is parsable and usable:
findmnt --verify --verbose
This lists any parsing errors, execution errors, and warnings. Once you resolve all errors, you can use
mount -a to mount the volume.