(Solved in 2021!) How to grow Ubuntu 20 root filesystem in AWS

popowich

EQ Forum Admin
Staff member
To grow your Ubuntu server root filesystem live (without a reboot):

Go to your AWS console and modify the EBS storage to the needed size:

1618061410750.png



Run blkid to get the device name:

> blkid
/dev/nvme0n1p1: LABEL="cloudimg-rootfs" UUID="7969d789-20ae-4f61-84ff-c0ac50e0dd19" TYPE="ext4" PARTUUID="8757600c-01"

Tell Ubuntu the increased storage is available:

> sudo growpart /dev/nvme0n1 1
CHANGED: partition=1 start=2048 old: size=1048573919 end=1048575967 new: size=1572861919 end=1572863967

Grow the live filesystem:

> sudo resize2fs /dev/nvme0n1p1
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/nvme0n1p1 is mounted on /; on-line resizing required
old_desc_blocks = 63, new_desc_blocks = 94
The filesystem on /dev/nvme0n1p1 is now 196607739 (4k) blocks long.

Verify the new filesystem size is correct:

> df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 762310580 447482140 314812056 59% /
 
Top