How to increase the storage of an EBS volume attached to an EC2 instance without rebooting the instance

Syedusmanahmad
3 min readMar 17, 2023

You can increase the storage of an EBS volume attached to an EC2 instance without rebooting the instance by following these steps:

  1. Open the AWS Management Console and navigate to the EC2 service and Select the instance to which the EBS volume is attached.
Here we have the EC2 instance with 8GB of EBS Volume

2. From the list of volumes, find the EBS volume you want to resize and note its current size.

EBS Volumes Page

3. Select the volume and choose the “Modify Volume” option from the “Actions” menu and in the “Modify Volume” dialog box, increase the size of the volume to the desired size.

  • Click “Modify” to save the changes.
Modifying the EBS volume to 20GB
EBS Volume has been modified
  1. Once the volume has been modified, you will need to resize the file system on the EC2 instance to make use of the additional storage. This process varies depending on the file system you are using, but the general steps are as follows:
  • Connect to the EC2 instance using SSH and run the command “df -h” to check the current storage size and its 8GB
  • With the command “lsblk” you can see the current storage size and modified storage size
  • Run the command to resize the file system. For example, if you use an ext4 file system, you can run the resize2fs command to resize the file system. The command may look something like this: sudo resize2fs /dev/xvda1. Note that the device name may vary depending on your specific configuration.
Now the xvda1 size is 19.9 GB

8. Verify that the file system has been resized by running the appropriate command for your file system. For example, you can run the df -h command to check the available disk space.

Conclusion & Caution:

By following these steps, you can increase the storage of an EBS volume attached to an EC2 instance without rebooting the instance. However, it is important to note that resizing a file system can be a potentially risky operation and should be performed with caution. Always make sure to back up your data before making any changes to your file system.

I hope you enjoyed reading this article, please feel free to contact me Syedusmanahmad if you have any questions.

Please feel free to write @ engr.syedusmanahmad@gmail.com | Linkedin https://www.linkedin.com/in/engrusman-ahmad for any queries on AWS/DevOps & stay tuned for the next write-up.

--

--

Syedusmanahmad

AWS & DevOps Architect | Linux, Docker, Kubernetes, Terraform, Jenkins, Git&GitHub, Ansible expert