How to Extend Disk Size on AWS EC2 Linux Instance

You increased your AWS EC2 EBS volume in the console, but df -h still shows the old size. This is normal. The AWS EC2 disk resize in AWS only grows the raw block device. You still need to extend the partition and then the filesystem before that space is usable. This guide covers all three steps on Linux, with no instance restart required.

AWS EC2 disk resize extend EBS volume Linux partition online
Resizing an EBS volume in AWS is only step one. The partition and filesystem also need extending before the new space is available.

Step 1: Resize the EBS Volume in AWS Console

Go to EC2 → Volumes in the AWS console, select the volume attached to your instance, and choose Modify Volume. Enter the new size and confirm. Or use the AWS CLI:

aws ec2 modify-volume --volume-id vol-xxxxxxxxx --size 100

Check the modification state:

aws ec2 describe-volumes-modifications --volume-id vol-xxxxxxxxx

Wait until the state shows optimizing or completed before continuing.

Step 2: Check the New Disk Size on Linux

SSH into the instance and confirm the kernel sees the larger disk:

lsblk

You should see the new size on the disk device (such as /dev/xvda or /dev/nvme0n1) but the partition below it still shows the old size. Also note current usage:

df -h

If lsblk still shows the old disk size, rescan the disk:

echo 1 > /sys/block/xvda/device/rescan

AWS EC2 Disk Resize: Extend the Partition

AWS EC2 Linux growpart extend partition terminal commands
growpart extends the partition to use all available disk space. It works on live, mounted partitions with no downtime.

Install growpart first if it is not already available:

# Ubuntu / Debian
apt install cloud-guest-utils -y

# RHEL / AlmaLinux / Rocky Linux
dnf install cloud-utils-growpart -y

Extend the partition. Note the space between the device and partition number:

# For xvda partition 1
growpart /dev/xvda 1

# For NVMe drives (newer instance types)
growpart /dev/nvme0n1 1

Run lsblk again to confirm the partition now matches the disk size. If your AMI uses LVM, also resize the physical and logical volumes:

pvresize /dev/xvda1
lvextend -l +100%FREE /dev/rootvg/rootlv

Our LVM disk management guide covers the full LVM resize process in detail.

Step 3: Extend the Filesystem

AWS EC2 disk resize filesystem ext4 xfs Linux resize2fs
After growing the partition, resize the filesystem. The command differs for ext4 and XFS but neither needs a restart.

Check your filesystem type first, then resize:

# Check filesystem type
df -Th

# ext4 - most Ubuntu and Debian AMIs
resize2fs /dev/xvda1

# XFS - Amazon Linux, RHEL, AlmaLinux AMIs
xfs_growfs /

The AWS documentation for recognizing expanded volumes on Linux covers edge cases for different instance and AMI types. For the growpart command details, see the growpart man page.

Confirm the new size:

df -h /

Automate on First Boot with User Data

To auto-extend the root partition when launching instances from a fixed-size AMI, add this to your EC2 user data:

#!/bin/bash
ROOT_DISK=$(lsblk -no PKNAME $(findmnt -n -o SOURCE /))
ROOT_PART_NUM=$(lsblk -no NAME $(findmnt -n -o SOURCE /) | tail -1 | tr -d '[:alpha:]')
growpart /dev/$ROOT_DISK $ROOT_PART_NUM
resize2fs $(findmnt -n -o SOURCE /) 2>/dev/null || xfs_growfs / 2>/dev/null

Conclusion

A full AWS EC2 disk resize on Linux needs three steps: resize the EBS volume in AWS, extend the partition with growpart, and grow the filesystem. None of these steps require a reboot. The whole process takes under five minutes. If your server has ever gone down because a disk filled completely, see our guide on recovering MySQL after a disk full event to handle that scenario cleanly.

}