How to Increase the Size of DigitalOcean Block Storage Volumes

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.

If you need more storage space than your current volume provides, you can attach additional volumes to the same Droplet or expand the size of a current volume.

Note
You cannot decrease the size of a volume. Data is not always sequentially written in memory, so reducing the available space risks data loss and filesystem corruption. As an alternative, you can create a smaller volume and transfer the contents of an existing volume to it using a tool like rsync.

Increasing the size of a volume has two steps:

  1. Resize the volume to make its disk larger.
  2. Expand the filesystem on the volume to use the new space.

Any changes to a filesystem can lead to data loss if something goes wrong, so we strongly recommend backing up the volume's data before resizing. One option is to create a snapshot of the volume.

Resize the Volume

You can increase the size of a volume in the control panel. From the volume's More menu, choose Increase size.

Volumes more menu

In the window that opens, select a new size for the volume. You can choose any size at least 1 GB larger than the volume's current size.

Increase volume size window

Click Resize volume to change the volume to the selected size.

Expand the Filesystem

In order to use the additional space, you need to expand the volume's filesystem.

Warning
Volumes are unpartitioned by default, but if you manually partitioned your volume when you created it, you need to expand the final partition before expanding the filesystem.

For unpartitioned volumes using the ext4 filesystem, pass the /dev/disk/by-id volume identifier to resize2fs:

sudo resize2fs /dev/disk/by-id/scsi-0DO_example
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/disk/by-id/scsi-0DO_example is mounted on /mnt/volume-example; on-line resizing required
old_desc_blocks = 25, new_desc_blocks = 32
The filesystem on /dev/disk/by-id/scsi-0DO_example is now 131072000 (4k) blocks long.

For unpartitioned volumes using the XFS filesystem, pass the mount point to the xfs_growfs tool:

sudo xfs_growfs /mnt/your_mount_point
meta-data=/dev/sda               isize=512    agcount=4, agsize=32768000 blks
        =                       sectsz=512   attr=2, projid32bit=1
        =                       crc=1        finobt=1 spinodes=0
data     =                       bsize=4096   blocks=131072000, imaxpct=25
        =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=64000, version=2
        =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 131072000 to 157286400

Verify that the larger filesystem is available with df:

df -h -x tmpfs -x devtmpfs
  
    
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G  1.1G   18G   6% /
/dev/sda        197G   60M  187G   1% /mnt/volume-nyc1-01

  

Depending on the Droplet's operating system, you may also need to reboot to see the volume's new size.