Ravindra BagaleCourses & study guides

Guides

How to Increase EBS Volume Size Without Downtime (EC2)

To increase an EBS volume without downtime, take a snapshot, then in the EC2 console choose the volume → Actions → Modify volume and enter the new size while the instance keeps running. Inside Linux, grow the partition with sudo growpart /dev/nvme0n1 1 and the filesystem with sudo xfs_growfs -d / (XFS, Amazon Linux) or sudo resize2fs /dev/nvme0n1p1 (ext4, Ubuntu). No stop or reboot is needed; EBS volumes can only grow, never shrink.

Students in my class always ask: "Sir, I increased the size in the console, so why does df -h still show 8G?" Look – the disk grew, but the partition and filesystem inside Linux did not. Example: your web server – logs filled the disk. Let's add space without stopping the server. Let's go.

Quick answer

After Actions → Modify volume (e.g. 8 → 20 GiB) and the state shows optimizing or completed, run on the instance:

lsblk                              # disk 20G, partition still 8G
sudo growpart /dev/nvme0n1 1       # grow partition 1 (note the space)
sudo xfs_growfs -d /               # XFS (Amazon Linux, CentOS) – mount point
# sudo resize2fs /dev/nvme0n1p1    # ext4 (Ubuntu) – partition device
df -hT /                           # new size

What do I need before resizing an EBS volume?

  • An EC2 instance and SSH access — see How to SSH into EC2.
  • The volume ID: EC2 → Instances → select the instance → Storage tab.
  • A snapshot of the volume, taken first (Step 1).
  • To know the device names: on Nitro instances (t3 and newer) the root disk is /dev/nvme0n1 and its first partition /dev/nvme0n1p1; on older Xen instances (t2) they are /dev/xvda and /dev/xvda1.

What happens when an EBS volume grows?

Growing an EBS volume without downtime While the instance keeps running, the EBS volume grows from 8 GiB to 20 GiB with Modify volume. Then growpart grows the partition to 20 GiB, and xfs_growfs grows the filesystem, so df -h finally shows 20 GiB. Instance: Running the whole time 1. EBS volumeActions → Modify volume 8 GiB20 GiB 2. Partitionsudo growpart /dev/nvme0n1 1 8 GiB20 GiB 3. Filesystemsudo xfs_growfs -d / 8 GiB20 GiB df -h shows the new size only after step 3.

The instance keeps running. First the EBS volume grows (Modify volume), then the partition (growpart), then the filesystem (xfs_growfs). Only then does df -h show the new size.

Resizing is a two-part job: (A) make the EBS volume bigger in AWS, then (B) make the partition and the filesystem inside Linux use the new space.

  Before: [ EBS 8 GiB  ][ partition 8 GiB ][ filesystem 8 GiB ]
  Step A: [ EBS 20 GiB                   ][ partition 8 GiB ][ filesystem 8 GiB ]   ← lsblk shows 20G disk, df still 8G
  Step B1 growpart:  [ partition 20 GiB ]
  Step B2 xfs_growfs / resize2fs: [ filesystem 20 GiB ]                              ← df now shows 20G

How do I increase the size of an EBS volume?

Step 1 — Take a snapshot

EC2 → Volumes → select the volume → Actions → Create snapshot → description before-resize → Create snapshot. EBS volumes can only be made bigger, never smaller, so the snapshot is your way back.

Step 2 — Modify the volume in the console

  1. EC2 → Instances → select the instance → Storage tab → click the Volume ID.
  2. Select the volume → Actions → Modify volume.
  3. Enter the new Size (e.g. 20 GiB); optionally change the type to gp3 → Modify → confirm.
  4. Wait until the Volume state shows in-use – optimizing or completed. The new size is usable as soon as it enters optimizing.

CLI alternative: aws ec2 modify-volume --volume-id vol-0123456789abcdef0 --size 20

Step 3 — Check the current layout

lsblk
df -hT

Example on a Nitro instance after Step 2 (root volume grown from 8 to 20 GiB):

NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
nvme0n1       259:0    0   20G  0 disk
├─nvme0n1p1   259:1    0    8G  0 part /
├─nvme0n1p127 259:2    0    1M  0 part
└─nvme0n1p128 259:3    0   10M  0 part /boot/efi

Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/nvme0n1p1 xfs   8.0G  1.9G  6.1G  24% /

The disk is 20G, but the partition nvme0n1p1 and the filesystem are still 8G.

Step 4 — Grow the partition

Note the space between the disk and the partition number:

sudo growpart /dev/nvme0n1 1          # Nitro instance
# sudo growpart /dev/xvda 1           # older Xen instance (t2)
lsblk                                  # nvme0n1p1 should now be 20G

growpart comes from cloud-utils-growpart (Amazon Linux, CentOS) or cloud-guest-utils (Ubuntu) and is usually pre-installed.

Step 5 — Grow the filesystem

Check the type in the df -hT output, then:

# XFS (default on Amazon Linux 2023, Amazon Linux 2 and CentOS Stream 9) – give the MOUNT POINT
sudo xfs_growfs -d /

# ext4 (default on Ubuntu) – give the PARTITION DEVICE
sudo resize2fs /dev/nvme0n1p1

Step 6 — Verify

df -hT /
lsblk

df shows 20G, and the server never stopped. 🎉

Ravindra Bagale's Tip

💡 Many students run resize2fs on XFS or forget the space in growpart /dev/nvme0n1 1. First check the filesystem type with df -hT: XFS needs xfs_growfs -d / (mount point), ext4 needs resize2fs (partition device). And always take a snapshot before resizing. Remember the order!

How do I grow a data volume without a partition?

If you formatted a whole extra disk directly (for example /dev/nvme1n1 mounted on /data, with no p1 partition), skip growpart. After Modify volume, just run:

sudo xfs_growfs -d /data              # XFS
sudo resize2fs /dev/nvme1n1           # ext4

cloud-init on Amazon Linux and Ubuntu also grows the root partition automatically at boot. If you increased the root volume and rebooted, df -h may already show the new size — the steps above are for doing it live, without a reboot.

Ravindra Bagale's Tip

After you modify a volume, you usually have to wait up to 6 hours before modifying the same volume again. So don't make lots of tiny changes – think about what you need for the next few months and pick the size once. And check df -h regularly, not when the disk is already at 100%.

How do I fix common EBS resize errors?

Ghabru naka 😅 — the fix is almost always one of these:

Symptom Likely cause Fix
df -h still shows the old size Partition and filesystem not grown sudo growpart /​dev/​nvme0n1 1, then xfs_growfs / resize2fs
growpart: NOCHANGE: partition 1 ... could only be grown by 0 Volume change not visible yet, wrong device, or already grown Wait for optimizing; check lsblk; use the disk name, not the partition
resize2fs: Bad magic number in super-​block Ran resize2fs on an XFS filesystem Use sudo xfs_​growfs -​d /
xfs_​growfs: ... is not a mounted XFS filesystem Gave a device or an ext4 filesystem XFS takes the mount point (/); ext4 uses resize2fs
growpart: command not found Package missing sudo yum install -​y cloud-​utils-​growpart (Ubuntu: cloud-​guest-​utils)
Modify volume is greyed out or refused Modified less than ~6 hours ago Wait, then try again
Want a smaller disk EBS cannot shrink Create a smaller new volume and copy the data

Learn it properly

This guide is the short path. The free AWS course explains every step in depth, with labs:

Got it? Growing the volume in the console is only half the job – the partition and filesystem inside must grow too. Snapshot, modify, growpart, xfs_growfs – and the server is not down for a single second.

Frequently asked questions

Can I increase an EBS volume without stopping the instance?

Yes. Modify the volume in the console while the instance runs, then grow the partition with growpart and the filesystem with xfs_growfs or resize2fs. No stop and no reboot are needed.

Why does df -h still show the old size after I modified the volume?

Only the disk grew. The partition and the filesystem inside Linux still use the old size until you run sudo growpart /dev/nvme0n1 1 and sudo xfs_growfs -d / (XFS) or sudo resize2fs /dev/nvme0n1p1 (ext4).

Can I make an EBS volume smaller?

No. EBS volumes can only be made bigger, never smaller. To get a smaller disk you must create a new volume and copy the data.

How often can I modify an EBS volume?

After a modification you must wait, usually up to 6 hours, before you can modify the same volume again.

Which command do I use: xfs_growfs or resize2fs?

Check with df -hT. XFS (default on Amazon Linux and CentOS Stream) uses xfs_growfs -d / with the mount point; ext4 (default on Ubuntu) uses resize2fs with the partition device.

Why does growpart say NOCHANGE?

The partition already fills the disk: the volume change has not reached the instance yet, you gave the wrong device, or cloud-init already grew it at boot. Check with lsblk.