How to Create and Attach Volumes

You can create and attach new volumes in four main contexts:

  • From the Droplet creation page
  • From the Create menu
  • From a Droplet’s Volumes page.
  • From the Droplets link in the main navigation, under the Volumes tab.

No matter how you create a new volume, before it’s ready for use for the first time, you’ll need to format and mount it.

Create a New Volume

During Droplet Creation

You can create and attach a new volume or attach an existing volume at the same time you create a Droplet in the Add block storage section. When you choose to add a volume, the selection of regions for the Droplet will be automatically limited to those regions where block storage is available.

Screenshot of Add Block Storage section

For an Existing Droplet

When you’ve already created a Droplet and it is located in a region with block storage support, you can create and manage volumes on its Volumes page: Screenshot of the Volumes tab

You can also create a new volume and attach it to an existing Droplet at any time from the Create menu.

Screenshot of Create menu

You can manage all the volumes associated with your account by following the Droplets link in the main navigation and selecting the Volumes tab:

Screenshot of the Droplets page

Format and Mount Volumes

When you first create a new volume, you will need to format it to create a file system. You generally only have to do this once because formatting a volume erases all the data on it. Every time you attach a formatted volume to a Droplet, you will need to mount it so your Droplet can access it.

Automatically

You can choose to automatically format and mount a volume for first-time use on supported distributions. When auto-mounting is available, it is selected by default. Otherwise, it will be grayed out and the manual option will be selected.

Screenshot of the Add volume screen

Automatic mounting uses the same commands and options that are provided in the instructions for manual formatting and mounting. The volume is auto-mounted into the /mnt directory with the options defaults,nofail,discard,noatime.

By default, Ext4 is selected as the default filesystem because of its stability, backwards compatibility, and mature support and tooling. You can also choose XFS, which specializes in performance for large data files.

Manually

All volumes can be manually formatted and mounted. Droplet-specific directions are available in the volume’s More menu under Config instructions.

Screenshot of Volume More menu

These customized directions have three parts that you can copy to paste directly into a terminal from your local machine. The three parts are:

  1. SSH to your Droplet, which includes the SSH command with the Droplet’s IP address filled in.

    If you’ve disabled root logins or are working with CoreOS, FreeBSD, or RancherOS, you’ll need to substitute the appropriate user for root.

  2. 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. Generally, this is a one-time-only task; when you format a volume it destroys all existing data.

    By default, this command uses the Ext4 filesystem. If you prefer, you can use the same commands to format the volume with XFS by changing mkfs.ext4 to mkfs.xfs.

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

Once a volume is formatted and mounted, it is ready to use.