There seems to be two methods I came across:
Method 1:
Go to EC2 -> Volumes -> Modify Volume.
Now, increase the Disk space allocation. The change will be reflected immediately, even on running system. Once done, go to Cloud9 terminal, and:
$ lsblk
nvme0n1 259:0 0 20G 0 disk
└─nvme0n1p1 259:1 0 10G 0 part /
$ sudo growpart /dev/nvme0n1 1
CHANGED: partition=1 start=2048 old: size=20969439 end=20971487 new: size=41940959,end=41943007
$ lsblk
nvme0n1 259:0 0 20G 0 disk
└─nvme0n1p1 259:1 0 20G 0 part /
$ sudo resize2fs /dev/nvme0n1p1
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/nvme0n1p1 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/nvme0n1p1 is now 5242619 (4k) blocks long.
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p1 20G 9.5G 9.9G 49% /
Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
Method 2:
I had issues while practicing docker commands as some images were large enough to exhaust the disk space. Since I read that images are stored in /var/lib/docker, I created an EBS volume of 25 GiB and mounted it at /var location. This solved my issues.
# This will show the attached devices
sudo lsblk
# Say, if the volume to be mounted is "/dev/nvme1n1", we can:
sudo mount /dev/nvme1n1 /var
# Now check disk usage
sudo df -h
Whenever I attached this new EBS to any other cloud9 instance, the docker images are already present, saving some time for me from downloading again.
So mounting volumes where such huge files are present will resolve this issue.