Can we extend AWS EBS volume ? Without any DOWNTIME ? Yes. You can do it without having any DOWNTIME in your server. AWS EBS stands for elastic block storage. This can be extended or shrink at any time without any affect for your server.

What is AWS EBS ( Elastic Block Storage ) ?

AWS EBS is a service which gives you storage for your EC2 instances. Its like a persistent hard disk in the cloud which could be attached to your EC2 instances and create your file system on top of the EBS volumes. Not like in S3 ( Simple storage service ) we can install any type of files in here, any operating system.

From this article we will test how can we extend our storage volume without any server downtime.

THIS CAN BE DONE IN PRODUCTION LEVEL…



We are using a Ubuntu machine for this example.

We can see currently we have the EBS volume with 8GB storage.

within the Linux server

To extend the volume, follow the below steps.

1) Go to Volumes under EC2 service.

2) Click on Modify volume.

3) Change the size of 8G to 16G and press modify button. You will get a window before modifying, click yes.

4) Go to your linux server with a putty session and type below commands

output of lsblk command shows us the total size of the disk has extended to 16G. But the new space is not added to the partition yet. Thats why /dev/xvda1 partition still shows as 8G. So we will add the newly added 8G to our partition.

growpart /dev/xvda 1

With growpart command, we can change the partition size in order to grow the size.

Syntax :



growpart <disk name> <partition number>



in here, the disk name is /dev/xvda and the partition we need to modify is the first partition. So we have to give number 1. If there were two partitions and we needed to change the second partition then the command would be growpart /dev/xvda 2.

Finally we can see new space has added to the parition.

5) resize the partition to affect for the mount point. First check your partition file system type.

If it is an ext file system, use resize2fs and if its an xfs file system, use xfs_growfs commands.

Its successfully done without any downtime. I guess now you could extend AWS EBS volume with no conflict.

Other resources:

Cheers.