How to Increase EC2 Volume Size Without Downtime?

Table of Contents

Get up to 50% off now

Become a partner with CyberPanel and gain access to an incredible offer of up to 50% off on CyberPanel add-ons. Plus, as a partner, you’ll also benefit from comprehensive marketing support and a whole lot more. Join us on this journey today!

Increase EC2 Volume Size – If you’re familiar with Amazon EC2 and EBS volumes, you’ve probably changed the size of an EBS volume before. AWS makes it simple to expand the size of your EBS volume. We could actually increase it without having to remove the volume or restart the instance. That’s quite impressive work, as we won’t have to worry about our instance being down.

What is AWS EC2 instance?

A virtual server on Amazon’s Elastic Compute Cloud (EC2) for running applications on the Amazon Web Services (AWS) infrastructure is known as an Amazon EC2 instance. AWS is a comprehensive and ever-evolving cloud computing platform, while EC2 is a service that allows business subscribers to run application programs in a computing environment. It may be used to create an almost infinite number of virtual machines (VMs).

To meet customer needs, Amazon offers a variety of instances with diverse CPU, memory, storage, and networking resource options. Each type is offered in a variety of sizes to meet the needs of different workloads.

Amazon Machine Images are used to build instances (AMI). The graphics of the machines are similar to templates. They have an operating system (OS) and other software installed that establish the user’s operational environment. Users can choose from AWS’s AMIs, the user community’s AMIs, or the AWS Marketplace. Users can also design and share their own AMIs.

What is EBS?

Elastic Block Store (EBS) is an AWS cloud-based block storage solution. EBS stores large amounts of data in blocks that function similarly to hard discs (called volumes). File systems, transactional data, NoSQL and relational databases, backup instances, containers, and apps are all examples of data types that can be stored using it. EBS is most commonly used for

EBS is a service provided by Amazon Web Services (AWS) and requires an AWS account. You can use the platform to improve performance and price. You can, for example, adjust the volume size and type, as well as eliminate duplicate volumes. You can configure backup and recovery solutions for your data from the platform.

Tech Delivered to Your Inbox!

Get exclusive access to all things tech-savvy, and be the first to receive 

the latest updates directly in your inbox.

EBS volume backup

It is always a good practice to have a backup of the EBS volume before expanding the size of the EBS volume; in the event that something goes wrong, you have the backup of the EBS volume and can recover your data. To access the AWS management console, go to the following website.

Backup EBS volume:

  • AWS management console dashboard
Increase EC2 Volume Size
  • Search for EC2
  • Before you begin, double-check that you are using the new EC2 console, as the previous EC2 interface may change slightly. Turn on the “New EC2 Experience” button in the top left corner of the EC2 service to move to the new EC2 console.
  • Select the “Volumes” option from the left side panel under “Elastic Block Store” after transitioning to the new EC2 console.
  • It will show you all of the EBS volumes that are available. Click the “action” button on top of the EBS volume of the instance you wish to resize
  • From the dropdown menu, choose “Create Snapshot”, and it will prompt you for a description for the snapshot.
  • Add a description and then click the bottom right corner “Create Snapshot” button.
  • Select the “Snapshot” option from the “Elastic Block Store” area on the left side panel, and a snapshot will be created.

Note: Wait for snapshot to be created before you do anything further.

Increase EBS volume size:

  • The first step is to raise the EBS volume size of your EC2 instance through the EC2 console after taking a snapshot of the EBS volume. Under “Elastic Block Store” select the “Volumes” options from the left hand side panel.
  • It will show you all of the EBS volumes that are available. Click the “Action” button on top of the EBS volume of the instance you wish to resize.
  • Select the “Modify Volume” option from the dropdown list to bring up a pop-up window.
  • It is evident from the pop-up that the volume type, as well as the volume size, can be modified. The size field displays the EBS volume’s current size, which is 30 GB. Increase the EBS volume size to the appropriate value and then click “Modify”
  • A fresh pop-up comes when you click the “Modify” button, asking for your permission to implement the changes.
  • When you click the “Yes” button, the EBS volume will be modified. Changing the volume can take some time. Check the volume’s state and wait for the optimization to finish.

Increase the size of the partitions

Once EBS volume size is increased we also need to increase the partition size and then grow file system.

  • Connect to your instance via SSH after raising the EBS volume size to check the EBS volume size.
  • Now use the df command to list all the filesystems mounted on your disk.
  • The root filesystem (/dev/xvda1) is still 30 GB in size and uses the ext4 filesystem format.
  • To see if the disc contains an extended partition, use the lsblk command in the terminal.

  • A partition (/dev/xvda1) exists on the root drive (/dev/xvda). The volume is 35 GB in capacity, but the partition is still 30 GB in size. To increase the partition size, use the growpart command in the terminal.
  • Use the lsblk command in the terminal to see if the partitions have grown in size.

Extend Filesystem

The volume and partition sizes have both been increased so far. To see if the root filesystem has been extended, use the df command.

The root filesystem is still 8 GB in size and needs to be expanded. Different commands are used to extend different types of filesystems.

Extend the ext4 filesystem

The resize2fs command is used to enlarge an ext4 filesystem.

Using the df command, list all the filesystems on your EC2 instance once more.

The filesystem’s size is raised after using the resize2fs command.

Enhance Your CyerPanel Experience Today!
Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!

Conclusion

If you are a cloud solution architect or system administrator, you should limit the resources that are provisioned initially, and then scale the resources as the traffic increases. It is possible to scale the resources almost all cloud service providers offer. An AWS EC2 instance’s disk space can be increased step-by-step in this article.

Editorial Team
The CyberPanel editorial team, under the guidance of Usman Nasir, is composed of seasoned WordPress specialists boasting a decade of expertise in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Since its establishment in 2017, CyberPanel has emerged as the leading free WordPress resource hub in the industry, earning acclaim as the go-to "Wikipedia for WordPress."
Unlock Benefits

Become a Community Member

SIMPLIFY SETUP, MAXIMIZE EFFICIENCY!
Setting up CyberPanel is a breeze. We’ll handle the installation so you can concentrate on your website. Start now for a secure, stable, and blazing-fast performance!