Resizing the EBS filesystem on a Cloud9 instance

Originally posted on 2020-10-23

Find your environment in Cloud9 and click it to get to the Environment details page.

Under EC2 Instance click Go To Instance and then click the instance ID.

On the bottom of the screen, below the instance summary panel, click Storage.

Click the link to the block device at the bottom.

Click Actions next to the Create Volume button.

Click Modify Volume.

Enter the new size and click Modify.

Wait until the disk is done resizing. The state will say in use with a green circle next to it before you modify the volume. Then it will still say in use while modifying it but the circle will turn yellow. Once the circle turns green again your volume will be resized. You can also check with lsblk in the Cloud9 terminal to see if the size listed for your disk has changed.

My Cloud9 instance started with a 10 GB EBS volume. Before modifying the volume the output of lsblk looked like this:

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0         7:0    0 12.7M  1 loop /snap/amazon-ssm-agent/495
loop1         7:1    0 87.9M  1 loop /snap/core/5328
loop2         7:2    0 97.8M  1 loop /snap/core/10185
loop3         7:3    0 28.1M  1 loop /snap/amazon-ssm-agent/2012
nvme0n1     259:0    0   10G  0 disk 
└─nvme0n1p1 259:1    0   10G  0 part /

Afterwards it looked like this:

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0         7:0    0 12.7M  1 loop /snap/amazon-ssm-agent/495
loop1         7:1    0 87.9M  1 loop /snap/core/5328
loop2         7:2    0 97.8M  1 loop /snap/core/10185
loop3         7:3    0 28.1M  1 loop /snap/amazon-ssm-agent/2012
nvme0n1     259:0    0  100G  0 disk
└─nvme0n1p1 259:1    0   10G  0 part /

At this point you need to resize the filesystem to fill the new disk. You can do this with growpart by telling it the name of the disk and which partition to grow. In my case the disk is named nvme0n1 and I want to grow the first partition so the command is:

sudo growpart /dev/nvme0n1 1

After that run lsblk again and it should look like this:

$ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0         7:0    0 12.7M  1 loop /snap/amazon-ssm-agent/495
loop1         7:1    0 87.9M  1 loop /snap/core/5328
loop2         7:2    0 97.8M  1 loop /snap/core/10185
loop3         7:3    0 28.1M  1 loop /snap/amazon-ssm-agent/2012
nvme0n1     259:0    0  100G  0 disk
└─nvme0n1p1 259:1    0  100G  0 part /

Now run df -h to see if the updated filesystem is in use. If not, just reboot and you should be set.