This website (currently) runs on AWS, with a standard Amazon Linux 2 AMI instance. After uploading a few more content onto the site (mostly images), I ran up to the limit of the EBS Elastic Volume that I had initially configured when setting up the instance.
While the process of modifying the volume size and subsequentially extending the partition and filesystem is very well documented in an AWS tutorial, I thought it might be helpful to walk through the specific steps I went through for my setup.
Step 1: Modify/increase the size of the volume in the AWS Console
To kick off the process, we must first raise the volume size in the AWS Console. You can navigate to the list of your available volumes from your EC2 dashboard and go to “Volumes”. In my case, I decided the increase the size from 12GB to 20GB.
Step 2: Check whether the volume has a partition
A partition already exists because it is an existing volume whose size I am trying to increase.
[ec2-user ~]$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 20G 0 disk └─xvda1 202:1 0 12G 0 part /
Step 3: Extend the partition
To extend the partition, we run the
growpart command and specify the partition to extend.
[ec2-user ~]$ sudo growpart /dev/xvda 1 CHANGED: partition=1 start=4096 old: size=25161695 end=25165791 new: size=41938911 end=41943007
We can now verify that the partition has been extended.
[ec2-user ~]$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 20G 0 disk └─xvda1 202:1 0 20G 0 part /
Step 4: Extend the file system
First, we need to get the name, size, type, and mount point for the file system we need to extend.
[ec2-user ~]$ df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/xvda1 xfs 12G 11G 1.1G 92% /
We can see that the
/dev/xvda1 file system is currently 12GB in size, its type is
xfs, and its mount point is
Next, we can use
xfs_growfs command to extend the file system, specifying the mount point at the end.
[ec2-user ~]$ sudo xfs_growfs -d / ... data blocks changed from 3145211 to 5242363
Step 4: Verify that the file system has been extended
df -hT again, the output should now reflect our changes.
[ec2-user ~]$ df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/xvda1 xfs 20G 11G 9.0G 56% /