Tuesday, December 3, 2013

Exanding size of your current EBS root volume

In some cases you may need to increase the size your EC2 instance root volume. Here are the steps to do this:

1. Create a volume from an existing EBS snapshot :
aws ec2 create-volume --snapshot-id snap-YourVolumesSnapshot --size 10 -- availability-zone az-asdf-1a 
2. Stop the instance:
was ec2 stop-instances --instance-id i-YourInstanceId
3. Detach the current volume:
was ec2 detach-volume --volume-id vol-TheSmallDefaultVolume
4. Attach the new volume:
was ec2 attach-volume --volume-id vol-TheLargerVolume --instance-id i- YourInstanceId --device /dev/sda1
5. Log into your bastion host:
ssh -i YourFile.pem ec2-user@10.__.__.__
7. Start the instance:
aws ec2 start-instances --instance-id i-YourInstanceId
8. Check the file system size: (It will still be the smaller size)
df –h

9. Resize the file system to the size of the volume
sudo resize2fs /dev/sda1

10. Check the file system size again:
df –h



No comments:

Post a Comment