Modify Attached EBS Volume Size on EC2 Linux Instance

modify attached EBS Volume
modify attached EBS Volume

Modify Attached EBS Volume Size

In this tutorial, We are going to Modify the Attached EBS Volume Size on the fly.

AWS will be now allowing to expand or increase Elastic block store(EBS) storage when it is attached to running EC2 instance.

It means customers no need to worry about how much storage might be required tomorrow.

Previously we had a choice earlier too to increase the volume size but that time we need to take the server offline first then create a snapshot of the volume and after that restoring the snapshot to the new volume and then re-attach new volume to the instance.

These steps need downtime to modify live EBS volume size.

AWS makes it really easy to change EBS volume size as per your requirement.

If you are new to AWS then please go through my previous articles on AWS which helps you to understand AWS better.

Read: How to Create AWS FREE TIER ACCOUNT

Read: Create your first free tier EC2 instance

Modify Attached EBS Volume Size

1. Log in to the AWS panel and then go to the “EC2 Dashboard”.

login aws

2. Go to the “Running instances” and choose the “instance/server” on which you want to modify attached EBS volume size.

In the Block Devices section, click on “Block device” which you want to modify and copy “EBS ID”.

EBS Block Device

3. Click on “Volumes” from the left panel, it will show all available volumes then paste volume id in the search section.

The volume will display below which we are going to modify.

AWS EBS Volume

4. You will see the current volume size is showing 500GB.

Now I am going to increase it from 500GB to 600GB.

For that, right-click on displayed volume and you will get the option to see the option “Modify volume”.

Click on “Modify Volume”

Modify volume

5. When you click on “Modify Volume”, you will get pop-up to change the volume size, volume type. But here we are going to change only the EBS Volume size.

Once you change the EBS volume size then click Modify Button.

AWS new volume
aws EBS volume

6. Now volume size starts modifying, you will see the status of modifying in the Description tab.

EBS Volume size modification will take time depends on the size of the volume and present data inside that volume.

So Be patient. it will not harm your data.

Expand EBS volume

7. If you are using a Linux box then you need to run below commands to resize the volume size.

Check the EBS volume is showing as “disk” or “part” because if it’s “part” then we need to run the “growpart command”

If type is “disk” then skip the “growpart command” and run resize2fs command directly to modify the EBS volume size.

Refer below screenshot where /data is in “part” type,

lsblk command

Run Growpart Command,

sudo growpart /dev/xvda 1

You can verify that the partitions reflect the increased volume size by using the “lsblk command” again.

In our case, it’s increased from 500GB to 600GB.

Now run below commands to apply the new volume size on disk,

$ resize2fs /dev/nvme4n1

resize2fs 1.42.9 (28-Dec-2013)

Filesystem at /dev/nvme4n1 is mounted on /DATA3; on-line resizing required

old_desc_blocks = 32, new_desc_blocks = 38

The filesystem on /dev/nvme4n1 is now 157286400 blocks long.

Previous

$ df -h

/dev/nvme3n1    493G 298G 170G  64% /DATA

After Size Increased

$ df -h

/dev/nvme4n1    591G 372G 190G  67% /DATA

I hope you like the article if you find any difficulties then please do comment your queries or problem via the comment section, till then stay tuned to Linuxgrow.com for more such valuable articles.

Prashant

Welcome to Linuxgrow. I'm Prashant, a tech-blogger from Mumbai, India. I started Linuxgrow as a passion and to share my knowledge about technologies. Here at Linuxgrow, I write about Linux technologies, Aws Cloud, Wordpress blogging and scripting knowledge. You can read more about me at About us page. Thank You :)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook