How to upgrade storage in VPS

Yes, I know the title is not good enough for many of you but not for me. I’m in a hurry when I need this feature. Lucky me, the process is not difficult at all.

Problem. One of vps server that reside in digitalocean need to upgrade the storage as the report told me about the service not run well due to unsufficient storage.

Further investigation tell me the truth.

df -H

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 32G 30G 278M 100% /
tmpfs 523M 0 523M 0% /dev/shm
4.0G 12M 3.8G 1% /tmp

Well, only 278M left after delete log file and a few old backup files.

I know if digitalocean provide volume service and now its time to use it 🙂

Click the ‘Add Volume’ button lead me to this display.

Enter size for this volume and set the name. Hit Create Volume button to start create the space.

Wow, really cool. You just need to copy and the command. It just works!

Step1 :

sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_skripsi

mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Step 2 :

sudo mkdir -p /mnt/skripsi; sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_skripsi /mnt/skripsi; echo /dev/disk/by-id/scsi-0DO_Volume_skripsi /mnt/skripsi ext4 defaults,nofail,discard 0 0 | sudo tee -a /etc/fstab

Check if mounted


/dev/vda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/home/usertmp_donotdelete on /tmp type ext4 (rw,noexec,nosuid,loop=/dev/loop0)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sda on /mnt/skripsi type ext4 (rw,discard)

Wow, in less than 5 minutes the job gets done and everyone happy 🙂

Thank You DigitalOcean, good work.