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 follow along, you need a DigitalOcean account. If you don't have one, you can register on the sign up page.
You can add a new volume to an existing Droplet or while creating a new Droplet.
From the Create menu in the top right of the control panel, click Volumes, then choose an existing Droplet to attach the volume to in Select Droplet to attach to.
Alternatively, on the Droplet create page, in the Add block storage section, click Add Volume.
Choose the size of your volume, which can be from 1 GB to 16 TiB (16,384 GB).
Format and mount the volume. This is automatic for supported operating systems. Instructions for manual formatting and mounting are in the volume's More menu under Config instructions.
Automatic and manual setup both format the volume with ext4, mount it into
/mnt with the options
defaults,nofail,discard,noatime, and update
/etc/fstab for persistent mounting across reboots.
You can move volumes between different Droplets in the same datacenter.
If you need more storage space, you can increase the size of a volume.
resize2fs. For XFS, use
You cannot decrease the size of a volume because of the risk of data loss and filesystem corruption.
Deleting a volume permanently and irreversibly destroys the volume and its contents.