I found many of us who use EC2 (Amazon Elastic Compute Cloud) instances of AWS (Amazon Web Services) face issue of increasing size of their current EC2 instance without disturbing environment at run time.
Here are simple steps which will help you to change your current EC2 instance's EBS (Elastic Block Store) volume size at run time through AWS console only.
- Create snapshot of existing (old) volume
- Then create new volume from created snapshot with new size
- Put new size there
- Stop running instance
- Detach current volume
- Attach newly created volume in step 2 with Device as /dev/sda1 (It works only with /dev/sda1)
- Then check with elastic IP address
- Then start instance.If you are not able to log-in, then disassociate IP and attach again and then start instance
- Finally after you gets connected through putty using either ec2-user for fedora/Amazon AMI and root for centOS
Run following commands
sudo su
sudo resize2fs /dev/sda1
If this command does not work, then give sudo resize2fs /dev/xvda1. Basically /dev/xvda1 denotes your existing name on file system.
It's done. :)
Reference Link: