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:
-
Verify existing disk usage. Type
df -hT
-
Verify existing block device. Type
lsblk
Based on example existing configuration, disk space is configured with 10 GB in size.
-
Go to aws console. Go to menu EC2 > Elastic Block Store > Volumes. Click on the block store that want to be extended
-
To prevent any unwanted issues, you can optionally create a snapshot for that ebs. Go to menu Actions > Create Snapshot
-
Configure snapshot description and tag (optional). After that, click Create Snapshot
-
Wait until create snapshot request succeeded, then click Close
-
Verify snapshot has been successfully created. Go to menu Elastic Block Store > Snapshot. Then verify
-
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
-
Modify volume size, after that click Modify
-
Modify volume confirmation page will be prompted. Click Yes to continue
-
Wait until modify volume request succeeded
-
Verify volume has been modified
-
SSH to your EC2 instance. Type this command:
sudo growpart [block_number]
in this example, the command should be:
sudo growpart /dev/xvda 1
-
Verify block device size has been extended
-
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
-
Verify your disk space has been extended
For further reference you can also check aws documentation on this link:
Top comments (1)
You can do this using powershell script, it will extend EBS volume from AWS as well as from OS end.
Extend Live EBS Volume