Resize volume without rebooting in DigitalOcean

This article guide you to resize the DigitalOcean volume without rebooting

1. Resize volume in the UI

After login to DigitalOcean console, navigate to Volumes. Click on the volume that you wist to resize, then select More -> Increase Size. It will open a popup.

After few seconds, you can see that size of the volume has been increased. but it won't reflect in the machine. We need to do some more steps to make it work.

Also note down, mount device and mount directory for that Volume. You can see those information in More -> Config Instructions

For example, "mount -o discard,defaults,noatime /dev/disk/by-id/scsi-0DO_Volume_volume-01 /mnt/data".
Here "/dev/disk/by-id/scsi-0DO_Volume_volume-01" is a device and "/mnt/data" is a directory.

2. Resize the filesystem

Lets ssh into the machine.

df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   17G  2.6G  87% /
/dev/sdb         40G   28G  9.6G  75% /mnt/data
sudo umount /mnt/data
sudo e2fsck -y /dev/disk/by-id/scsi-0DO_Volume_volume-01
sudo resize2fs /dev/disk/by-id/scsi-0DO_Volume_volume-01
sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-01  /mnt/data
df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   17G  2.6G  87% /
/dev/sdb         80G   28G  52G   35% /mnt/data

So we have increased the DigitalOcean volume without rebooting.

Vote on HN

comments powered byDisqus