How To Increase EBS Volume

Posted By : Vinay Mann | 24-Jun-2022

To Increase the size of EBS volume without any downtime

 

This is a practice where we perform how to resize the volume of an EC2 instance 

without any downtime on our server.


Before this let’s take  an introduction about the EC2 instance and Volumes

EC2 :

 

EC2 called Elastic Cloud Compute is a virtual machine that represents a physical server for users to deploy their applications. Instead of getting your hardware system and connecting it to the network, Amazon cloud provides you nearly unlimited virtual machines on the cloud to run your applications while they manage the hardware. EC2 instances provide a  feature that is radical to cloud computing called Auto-Scaling Groups. This feature allows EC2 instances to automatically add additional computing power like CPU utilization which gets affected due to high demand. AWS provides support for multiple operating systems from Windows to different flavors of Linux etc. As a customer, you can also able to bring your customized  OS images and run them on their platform. This allows users to use boundless capabilities for running applications on the cloud.

 

Volumes :

 

AWS EBS is mainly defined as a raw block-level storage service or device, meant to be used with EC2 instances. Each block on the cloud acts like a hard drive, where you can store any type of file or even a whole operating system can be installed on that block device. Each EBS volume that you connect with your EC2 instance is automatically replicated within its AZ to prevent any loss of data and component failure on the cloud. With EBS, we can easily scale our usage up or down in a matter of minutes.


For this, we have to follow some set of commands and we will be able to resize it.

Firstly you have to add the volume from the AWS cloud console.

 

Commands:

 

          

  1. df -hT 

 

 This command  list out the mount devices with their file system but you will not be able to see the extended volume partition
 

 

  1. lsblk    

 

Now using this command will be able to see the extended volume partition
 

  1. sudo growpart /dev/xvda 1     

 

This command will increase the partition size but you have to mention the 

 partition name
 

  1. sudo xfs_growfs -d /

 

              This command will resize your actual volume and this for
              Xfs file system 

 

      #Note: The growfs command depends on the file system
 

      4. sudo resize2fs /dev/nvme0n1p1   

          

             ( This is for ext2,ext3 and ext4 file system )

 

  1. df -hT     ( you will see that your volume gets extended with the new size.)

                 

About Author

Author Image
Vinay Mann

Vinay is a highly experienced DevOps Engineer with expertise in various industry-standard tools and technologies. His skill set includes Linux administration, AWS services, Docker, Kubernetes, Ansible, Git, Jenkins, Terraform, Python, and Shell scripting. He has contributed to projects like Oodles dashboard, Communication Scaffold, and Oodles.com. Vinay has also earned certifications in AWS Solution Architect and RHCSA, demonstrating his proficiency in these domains. He plays a crucial role in ensuring the seamless functioning of software development and deployment processes.

Request for Proposal

Name is required

Comment is required

Sending message..