Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

You enlarged the EBS volume but the instance still shows the old size

Errordf -h shows the old size after the volume was increased

Short answer

Enlarging an EBS volume only changes the disk. The partition and the file system inside it keep their old size until you extend them. Run lsblk to compare sizes, growpart on the partition, then xfs_growfs for XFS or resize2fs for ext4. Take a snapshot first.

  • Applies to Amazon Linux 2023, Ubuntu 24.04, XFS, ext4
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Compare the disk size with the partition size, then the file system size and type.

    lsblk
    df -hT
  2. 2Match what you see, then jump to its fix

    1. 1lsblk shows the disk larger than its partitionThe partition was never extendedFix
    2. 2df -hT shows type xfs and the old size, even though the partition is now largeThe XFS file system was not extendedFix
    3. 3df -hT shows type ext4 with the old sizeThe ext4 file system was not extendedFix
    4. 4mkdir: cannot create directory ... No space left on device and FAILED: failed to make temp dirThe disk is out of space, so growpart cannot startFix

What does the error look like?

  • df -h shows the old size after the volume was increased
  • NOCHANGE: partition 1 is size 16773087. it cannot be grown
  • xfs_growfs: /data is not a mounted XFS filesystem
  • The filesystem is already 3932160 blocks long. Nothing to do!

Cause 1 of 4

The partition was never extended

1Check

In the lsblk output, if the partition is smaller than the volume, the partition must be grown first. The volume must be in the optimizing or completed state.

sudo lsblk

2Fix

Run growpart with the device name and partition number, with a space between them. Use the device lsblk shows (nvme0n1 on Nitro, xvda on Xen).

sudo growpart /dev/nvme0n1 1

3Verify

lsblk now shows the partition and the volume at the same size.

sudo lsblk

Confirmed by docs.aws.amazon.com

Did this fix it?

Cause 2 of 4

The XFS file system was not extended

1Check

Get the mount point and type from df -hT.

df -hT

2Fix

Run xfs_growfs against the mount point, not the device.

sudo xfs_growfs -d /

3Verify

df -hT shows the new size for that mount point.

df -hT /

Confirmed by docs.aws.amazon.com

Did this fix it?

Cause 3 of 4

The ext4 file system was not extended

1Check

A Bad magic number error from resize2fs means the file system is not ext4, so check the type again.

df -hT

2Fix

Run resize2fs with the partition device that df -hT shows.

sudo resize2fs /dev/nvme0n1p1

3Verify

The reported size equals the volume size.

df -hT /

Confirmed by docs.aws.amazon.com

Did this fix it?

Cause 4 of 4

The disk is out of space, so growpart cannot start

1Check

growpart needs a little free space for a temporary directory.

df -h /tmp /

2Fix

Free some space, for example by removing old logs or packages, then run growpart again.

sudo du -xh / --max-depth=1 | sort -h | tail

3Verify

growpart completes and lsblk shows the larger partition.

sudo growpart /dev/nvme0n1 1

Confirmed by docs.aws.amazon.com

Did this fix it?

How do I stop it coming back?

  • Take a snapshot before every partition change, as AWS advises.
  • Wait until the volume modification reaches optimizing or completed.
  • If the volume uses LVM, extend the logical volume as well; growpart alone is not enough.
  • Write the steps in a runbook with your device names so the next resize takes minutes.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.