How to Extend AWS NVMe Volumes with No Downtime

Sujit Patel
2 min readOct 28, 2021

--

This article guide you to resize the EBS volume without rebooting.

In order to extend the volume size, follow these simple steps:

  1. Login to your AWS console
  2. Navigate to EC2 -> Elastic Block Store -> Volumes. Click on the volume that you want to resize, then select Actions -> Modify Volume. It will open a popup.
  3. Set the new size for your EBS volume (for example i’m increasing size form 8GB to 16 GB). and click modify. Click yes to confirm popup.
modify EBS volume

Now the volume has been resized, but it won’t reflect in the system. we need to extend the partition itself.

4. SSH into the EC2 instance.

i. List block devices attached to the machine.

sudo lsblk
list block devices

ii. You can see that root partition is still 8 GB. Let's increase the partition to disk size.

sudo growpart /dev/nvme0n1 1
increase the partition size

iii. Now partition size is increased to disk size. we can check using lsblk command.

sudo lsblk
check partition size

iiii. Now we need to extend our filesystem.

if your filesystem is is an ext2, ext3, or ext4, type:

sudo resize2fs /dev/nvme0n1p1
extend filesystem

if your filesystem is an XFS, then type:

sudo xfs_growfs /dev/nvme0n1p1

Now everything is done. You can check space type:

df -h
check space

Congratulations You have successfully extended your EBS volume with ZERO downtime.

--

--

Sujit Patel
Sujit Patel

Written by Sujit Patel

DevOps Engineer, Linux lover, Technology and Automation enthusiast. A strong believer in continuous learning.