Extending Volume of AWS Micro instance from 10GB to 50 GB

Extending Volume of AWS Micro instance from 10GB to 50 GB

Scenario :

You have aws EC2 instance and storage is 100% full.

Requirement :

Change volume size from 10 GB To 50 GB without restarting without loosing any data

 

Create a snapshot as backup

 

Modify Volume

 

Connect to instance

Connect to the instance by SSH

Run df -hT  to make sure storage is full

In our case system shows that /dex/xvda1 – > 100%

 

Run lsblk command to make sure Volume modification was success

 

now run command to grow root partition

sudo growpart /dev/xvda 1

Now run lsblk command to see the impact

 

sudo resize2fs /dev/xvda1

and finally check the size for df -h

Result

Point 3 shows that now we have 80% space.

 

Remarks : I had a moodle instance in AWS t2. micro was getting below error message because of low disk space.

The session partition is full. It is not possible to log in at this time. Please notify the server administrator.