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.
To create and use a new volume with a Droplet, you need to create the volume itself, and then format and mount it to prepare it for use. Formatting and mounting is automatic by default for Droplets with supported operating systems, and you can choose to format and mount manually.
To start creating a volume from the control panel, open the Create menu and select Volumes. You can also create and attach a new volume as you create a new Droplet, in the Droplet create page’s Add block storage section.
In the Select Volume Size section, choose the size of the volume, either by selecting a preset size or entering a size in gigabytes.
You can increase the size of a volume after you create it.
In the next section, choose the Droplet that you want to attach the volume to and enter a name for the volume. Volumes are located in the same datacenter and project as their associated Droplets.
You can create a volume while creating a new Droplet, in the Add block storage section of the Droplet create page. Volumes you create this way have automatically generated names and are attached to the new Droplet, so the Select Droplet to Attach To and Name Volume sections do not display from the Droplet create page.
In the Choose Configuration Options section, you choose how you want to format and mount the new volume.
A newly-created volume has no filesystem, which is what lets a Droplet’s operating system read and write files to it. Formatting a volume creates a filesystem on it (and erases any existing data). You only need to format a volume once, when you first create it. Mounting a formatted volume makes its filesystem accessible to its Droplet. You need to mount the volume every time you attach it to a Droplet.
You can automatically format and mount volumes to Droplets with supported operating systems, and this option is selected by default when it is available. You can always choose to manually format and mount volumes.
When you automatically format and mount a volume, you also choose a filesystem. ext4 is the default because of its stability, backwards compatibility, and mature support and tooling. XFS, which specializes in performance for large data files, is also available.
Automatic mounting uses systemd on distributions that support it. The mount unit files are
/etc/systemd/system/mnt-volume_*.mount. The udev rules that control the configuration are in
On non-systemd distributions, automatic mounting uses
fstab, following the same commands and options provided in the control panel’s instructions for manual formatting and mounting.
Volumes are auto-mounted into the
/mnt directory with the options
If you choose to manually format and mount your volume, you can use the Droplet-specific directions in the volume’s More menu under Config instructions.
The instructions include three customized commands that you can copy and paste into a terminal from your local machine:
SSH to your Droplet, which includes the SSH command with the Droplet’s IP address filled in. If you disabled
root logins or use CoreOS, FreeBSD, or RancherOS, you need to substitute the appropriate user for
Format the volume: One time only, which includes the commands to set up a filesystem with the Droplet’s IP address and the SCSI ID of the volume pre-filled. This command specifies ext4 for the filesystem. To use XFS, If you prefer, change
Mount the volume, which includes the commands to create a mount point, mount the volume, and set the volume to automatically mount when you reboot. The specific SCSI ID of the volume is pre-filled.
After you’ve chosen all necessary settings, click Create Volume to create the volume. Once the volume is formatted and mounted, it is ready to use.
If a Droplet is in a volume-supported datacenter, the Droplet’s Volumes page lets you create and manage its volumes. You can manage all the volumes associated with your account on the Volumes page:
After mounting the volume, it is accessible on your Droplet at
/mnt/your-volume-name. You can use this path to do any file operations you would do with a native volume, including creating, moving, or deleting files.
If you do not change the volume name at creation time, it will be given a default name based on the volume’s datacenter, making the path something like
/mnt/volume-nyc3-01. You can run
ls /mnt to get a list of attached volumes and their paths.