DEV Community

Luthfi Anandra
Luthfi Anandra

Posted on

Extend EBS Volume

In this article, i want to share some information how to extend your aws ebs volume. In this example, i use ec2 instance with ubuntu operating system and mount gp2 ebs volume to that ec2.

EC2 instance is using non Nitro System or non NVMe volume

The scenario is, i have existing ebs volume with size 10 GB then i want to extend the volume to 20 GB

Here are few configuration steps to extend linux ebs volume:

  1. Verify existing disk usage. Type df -hT

    Alt Text

  2. Verify existing block device. Type lsblk

    Alt Text

  3. Based on example existing configuration, disk space is configured with 10 GB in size.

  4. Go to aws console. Go to menu EC2 > Elastic Block Store > Volumes. Click on the block store that want to be extended

    Alt Text

  5. To prevent any unwanted issues, you can optionally create a snapshot for that ebs. Go to menu Actions > Create Snapshot

    Alt Text

  6. Configure snapshot description and tag (optional). After that, click Create Snapshot

    Alt Text

  7. Wait until create snapshot request succeeded, then click Close

    Alt Text

  8. Verify snapshot has been successfully created. Go to menu Elastic Block Store > Snapshot. Then verify

    Alt Text

  9. Then, you can modify your EBS volume. Go to menu Elastic Block Store > Volumes. Click on the volume you want to extend. Then click Actions > Modify Volume

    Alt Text

  10. Modify volume size, after that click Modify

    Alt Text

  11. Modify volume confirmation page will be prompted. Click Yes to continue

    Alt Text

  12. Wait until modify volume request succeeded

    Alt Text

  13. Verify volume has been modified

    Alt Text

  14. SSH to your EC2 instance. Type this command:

    sudo growpart [block_number]

    in this example, the command should be:

    sudo growpart /dev/xvda 1

    Alt Text

  15. Verify block device size has been extended

    Alt Text

  16. Resize your block device to new size. Type this command:

    sudo resize2fs [block_number]

    in this example, the command should be:

    sudo resize2fs /dev/xvda1

    Alt Text

  17. Verify your disk space has been extended

    Alt Text

For further reference you can also check aws documentation on this link:

Link

Top comments (1)

Collapse
 
maxautomation profile image
Mayank Agarwal

You can do this using powershell script, it will extend EBS volume from AWS as well as from OS end.

Extend Live EBS Volume