When an AWS EC2 instance runs low on disk storage, AWS Elastic Block Store (EBS) Elastic Volumes allow administrators to increase volume capacity dynamically without detaching volumes or rebooting the server. However, expanding the volume in AWS only changes the underlying virtual disk size; you must still extend the partition table and resize the filesystem inside Linux.
Production Warning: Always create an AWS Backup snapshot or EBS snapshot before resizing partitions on mission-critical databases or production servers.
At a Glance
- Modify the EBS volume size using the AWS Management Console or AWS CLI.
- Monitor volume state until it transitions to
in-use(optimizing). - SSH into the Linux instance and check disk block device visibility with
lsblk. - Extend the partition boundary using
growpart. - Resize the underlying filesystem using
xfs_growfs(for XFS) orresize2fs(for ext4). - Verify the expanded capacity with
df -h.
Prerequisites
Before resizing your storage, verify:
- IAM permissions to execute
ec2:ModifyVolumeandec2:DescribeVolumes. - SSH root or sudo access to the target EC2 Linux instance.
- Volume is formatted with an online-resizable filesystem (XFS or ext4).
- The EBS volume has not been modified within the last 6 hours (AWS Elastic Volume rate limit).
Step 1: Modify the EBS Volume in AWS
You can expand the volume size via the AWS CLI or the AWS EC2 Console:
# Modify volume size to 100 GiB (replace vol-0123456789abcdef0 with your volume ID)
aws ec2 modify-volume --volume-id vol-0123456789abcdef0 --size 100
Wait until the volume state transitions from modifying to in-use.
Step 2: Verify Block Device Visibility on the Linux Host
SSH into your Linux EC2 instance and inspect block devices:
# Display block devices and partition layout
lsblk
Expected output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 100G 0 disk
├─nvme0n1p1 259:1 0 40G 0 part /
└─nvme0n1p128 259:2 0 1M 0 part
Notice that the physical disk (nvme0n1) reflects 100G, but partition 1 (nvme0n1p1) is still 40G.
Step 3: Install and Run growpart to Extend the Partition
Install growpart if not already present on your AMI:
# On Ubuntu / Debian:
apt-get update && apt-get install -y cloud-guest-utils
# On AlmaLinux / Rocky Linux / RHEL / Amazon Linux 2023:
dnf install -y cloud-utils-growpart
Grow the target partition (note the space between the device path and partition index):
# For NVMe devices (e.g. nvme0n1 partition 1):
growpart /dev/nvme0n1 1
# For Xen block devices (e.g. xvda partition 1):
growpart /dev/xvda 1
Expected output:
CHANGED: partition=1 start=2048 old: size=83884032 end=83886080 new: size=209713119 end=209715167
Step 4: Resize the Linux Filesystem
Identify your filesystem type:
# Inspect filesystem type and mount point
df -Th
Option A: For XFS Filesystems (Default in RHEL, AlmaLinux, Rocky Linux, Amazon Linux)
# Run xfs_growfs passing the mount point
xfs_growfs -d /
Option B: For ext4 Filesystems (Default in Ubuntu and Debian)
# Run resize2fs passing the partition device path
resize2fs /dev/nvme0n1p1
Troubleshooting
Problem: “growpart: NOCHANGE: partition 1 is size 83884032. it cannot be grown”
Possible cause: The EBS volume modification has not yet propagated to the virtual hypervisor, or you specified an incorrect partition index.
Check:
lsblk
Solution: Run partprobe or wait 60 seconds for the AWS hypervisor to update the virtual NVMe controller.
Problem: “xfs_growfs: / is not a mounted XFS filesystem”
Possible cause: The root filesystem is formatted as ext4 instead of xfs.
Check:
df -Th /
Solution: Use resize2fs /dev/DEVICE_PARTITION instead of xfs_growfs.
Verify the Configuration
Verify that the operating system recognizes the expanded capacity:
df -h /
Expected output:
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p1 99G 14G 85G 15% /
Production Checklist
- Captured an EBS snapshot prior to partition expansion.
- Modified volume size in AWS Console / CLI.
- Confirmed disk size in
lsblk. - Grown partition boundary using
growpart. - Expanded filesystem using
xfs_growfsorresize2fs. - Verified available disk space with
df -h.
Frequently Asked Questions
Can I decrease or shrink an EBS volume size online?
No. AWS EBS does not support shrinking volumes directly. To reduce volume size, you must attach a smaller new EBS volume and copy data over using rsync.
Will resizing an EBS volume cause downtime or dropped TCP connections?
No. Elastic Volumes and online filesystem resizing with xfs_growfs / resize2fs operate completely live with zero downtime.
Related Guides & Services
- How to Troubleshoot High Load on Linux Servers
- AWS Cloud Infrastructure Management
- Linux Server Administration & Tuning
Need Help Managing AWS Cloud Infrastructure?
If you need proactive cloud monitoring, automated EBS volume scaling, or multi-region disaster recovery architecture, connect with our AWS certified engineers.