Resize your AWS EC2’s EBS Volume Size with ZERO DOWNTIME
1. Go to EC2 dashboard and search the instance you want to increase. Click the instance and check the description below
2. Click root device then EBS ID and you will be redirected to EBS page.
3. Click Actions button then Modify Volume button. Change the size to your desired size. (ex. 250 to 300). Click Modify button.
4. Wait for the State to finish optimizing before applying the commands in next steps.
5. SSH into the instance and check the List Block Sevices that attach to EC2 (check if its
xvda (Amazon Linux)
As you can see
xvda1 is still 8 gb partition part and
nvme0n1p1 is still 250G (not 300G) and there are no other partitions on the volume. Let’s use “growpart” to resize 8G partition up to 16G / 250G to 300G:
6. Use growpart command to resize the partition.
Check the changes on your partitions using
df -h commands. You can see /dev/xvda1 is now 16G and 300G for /dev/nvme0n1
7. Resize file system to grow all the way to fully use the new partition space. Check the column (Size, Used, Avail) then
df -h again after
resize2fs command to see the changes.
#Check filesystem command df -h #resize filesystem sudo resize2fs /dev/nvme0n1p1 #check again after resizing df -h
#Check filesystem command df -h #resize filesystem sudo resize2fs /dev/xvda1 #IF resize2fs doesn't work do this instead sudo xfs_growsfs /dev/xvda1 #check again after resizing df -h
Bookmark this for your future reference.
Congratulations you successfully resize your EC2’s EBS volume with zero downtime.