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.
- i) Enter the new size in the size field. Lets says we are resizing from 40 GB to 80 GB.
- ii) Click Resize Volume button
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.
- i) Check the file system size. (Still it shows only 40 GB)
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
- ii) Unmount the directory. (If any process writes into this directory, just stop it and start after you finish below steps.)
sudo umount /mnt/data
- iii) Check a file system
sudo e2fsck -y /dev/disk/by-id/scsi-0DO_Volume_volume-01
- iv) Resize the filesystem
sudo resize2fs /dev/disk/by-id/scsi-0DO_Volume_volume-01
- v) Remount the directory
sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_volume-01 /mnt/data
- vi) Check after resizing
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.