Hi! I’m Dele Bakare (DB), CEO and Founder of Findworka. Technology excites me, so in this article I will be sharing a detailed guide on how to increase disk size for an EC2 instance on Amazon web services.
I know for some engineers, Amazon EC2 is still the preferred platform for deploying web servers but they still get frustrated with scaling servers on EC2 since the best thing to do is to start small and scale when necessary. Therefore, by default, your new server is on the t2.micro and that only provides 8GB worth of disk size.
So how do you increase 8GB to perhaps 50GB on your EC2 Instance?
The first thing to do in this scenario is to log in to your AWS Management Console and stop your instance from running.
Go to Services -> EC2 -> Instances
Check the instance you want to add more disk space and click on the Actions button as shown below and Stop the instance from running.
Now that you have stopped the instance from running, simply navigate to Elastic Block Store -> Volumes.
Check the box on the volume you want to increase and click the Actions button. Click the Modify Volume option and enter the number of GB you want in the Size field. Click the Modify button once you’re done.
Now Reboot your instance. (See the image above for the reboot option).
SSH to your server and run the command df -h . You will probably see something like this
As you can see, our disk partition is here — /dev/xvda1 and the disk size is now 49G and 3.0G is being used. It means we have successfully added more space to this disk partition.
You can also run this command lsblk to confirm the xvda1 partition is using the full capacity of the disk.
If yes, congratulations you have successfully increased the size of your instance.
If no, run this command sudo growpart /dev/xvda 1 for the xvda1 partition to increase to the xvda capacity.
That’s it. Go and get yourself a bottle of drink.
If you loved this article, share, clap and leave a comment.