How do I increase the size of my EBS volume if I receive an error that there's no space left on my file system?

To Nha Notes | Feb. 16, 2023, 10:55 a.m.

Short description

To avoid No space left on device errors when expanding the root partition or root file system on your EBS volume, use the temporary file system, tmpfs, that resides in memory. Mount the tmpfs file system under the /tmp mount point, and then expand your root partition or root file system.

Example

The following example shows that the root EBS volume block device (/dev/nvme0n1) is 9 GiB, and the root partition (partition 1) is already 8 GiB.

$ lsblk
NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1       259:0    0   9G  0 disk
├─nvme0n1p1   259:1    0   8G  0 part /
└─nvme0n1p128 259:2    0   1M  0 part

If you attempt to increase the root partition (partition 1), you receive one of the following errors:  

$ sudo growpart /dev/nvme0n1 1
/bin/growpart: line 248: /tmp/growpart.fklt5u/dump.out: No space left on device
FAILED: failed to dump sfdisk info for /dev/nvme0n1

-or-

$ sudo growpart /dev/nvme0n1 1
CHANGED: partition=1 start=4096 old: size=16773087 end=16777183 new: size=18870239 end=18874335
FAILED: failed: sfdisk --list /dev/nvme0n1

Note: It's a best practice to create an Amazon Machine Image (AMI) backup of the instance or a snapshot of the root EBS volume that's attached to your instance before attempting the resolution steps. A backup allows you to recover your data from unforeseen issues.

Check resolution

References

https://aws.amazon.com/premiumsupport/knowledge-center/ebs-volume-size-increase/