skip to Main Content

Extending a Linux File System After Resizing a Volume

After you increase the size of an EBS volume, you must use file system–specific commands to extend the file system to the larger size. You can resize the file system as soon as the volume enters the optimizing state.

Important: Remember to backup! It is best to create a snapshot before attempting and file system operations.

Identifying the File System for a Volume

The following example shows a T2 instance that has a boot volume with an ext4 file system and an additional volume with an XFS file system.

[ec2-user ~]$ sudo file -s /dev/xvd*
/dev/xvda:  DOS/MBR boot sector ..
/dev/xvda1: Linux rev 1.0 ext4 filesystem data ...
/dev/xvdf:  SGI XFS filesystem data ...

Extending a Partition

To extend the partition on the root volume, use the following growpart command. Notice that there is a space between the device name and the partition number.

[ec2-user ~]$ sudo growpart /dev/nvme0n1 1
[ec2-user ~]$ sudo resize2fs /dev/nvme0n1p1

You can verify that the partition reflects the increased volume size by using the lsblk command again.

[ec2-user ~]$ lsblk
nvme1n1       259:0    0  30G  0 disk /data
nvme0n1       259:1    0  16G  0 disk
└─nvme0n1p1   259:2    0  16G  0 part /
└─nvme0n1p128 259:3    0   1M  0 part


Back To Top