Extending Partition Without Rebooting (EBS Amazon Linux)

This guide assumes that you are using a Linux OS in AWS EC2 and are not using LVM. In the example below we will walk through the steps of growing an EBS volume.

First we need to go to the “Volumes” page of EC2 and right click the volume we wish to expand and click modify. Increase the size to the desired amount and press modify. Once the storage amount changes in the EBS volume screen we are ready to proceed.

SSH into the machine we extended the drive for and run the following command to identify the drive. This may vary on systems with multiple disks, however for most single volume EC2 machines this will be /dev/xvda1

sudo lsblk

NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT

xvda    202:0    0  40G  0 disk

└─xvda1 202:1    0  40G  0 part /

Next once you’ve identified the disk (in my case above it’s /dev/xvda1, you’ll want to run the following commands:

To grow the partition run(make note of the space between the device and partition number): sudo growpart /dev/xvda 1

Finally to grow our partition to be used by the OS:
sudo resize2fs /dev/xvda1

Note: if you are running an XFS file system you may need to run xfs_growfs instead of resize2fs