As we quickly show you how to increase volume size of DigitalOcean Block Storage it is important to know what volumes are. Volumes are network-based block devices that provide additional data storage for DigitalOcean Droplets. Volumes can be move between Droplets and they can be resized by increasing their size at any time. To protect data you cannot decrease the size of a volume. If you need a smaller volume it is best to export the data to a new smaller volume then attach that to your droplet.
Why Increase Volume Size of DigitalOcean Block Storage
If you need more storage space than your current volume provides, you can either attach additional volumes to the same Droplet or expand the size of a current volume. In most cases the latter is more desirable.
There are two steps to Increasing the size of a volume:
- Resize the volume to make its disk larger.
- Expand the filesystem on the volume to use the new space.
- Optionally reboot your Droplet if necessary.
Before resizing, it is strongly recommend that you take a snapshot of the volume before resizing. This is because any changes to a filesystem can lead to data loss if something goes wrong. The snapshot can be deleted after confirming that the resize was successful.
Resize the Volume
From the DigitalOcean control panel, you can increase the volume’s size. Go to the volume’s More menu then choose Increase size. 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.
Click Resize volume to change the volume to the selected size.
Expand the Filesystem
To use the additional space, you need to expand the volume’s filesystem. You can check which kind of filesystem is on the volume with df -T /path/to/your_mount_point.
You will then get the following 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.
You will also be presented with options as follows:
Expand ext4 filesystems – 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
Expand XFS filesystems – For unpartitioned volumes using the XFS filesystem, pass the mount point to the xfs_growfs tool:
$ sudo xfs_growfs /mnt/your_mount_point
Verify that the larger filesystem is available with df:
$ df -h
Some operating systems require a reboot to see the volume’s new size. If you do not see the volume’s new size, reboot your Droplet.
Conclusion
In conclusion, here we’ve discussed how you should increase volume size of DigitalOcean block storage first using the DigitalOcean control panel and granting access to the additional space from either of the ext4 and XFS filesystems.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.