TECHIES WORLD

For Techs.... Techniques.... Technologies....

AWSBashLinux

How to increase AWS EBS root partition for NVMe filesystems

Step1: Login to the AWS console and navigate to EC2 management console.

Step2: Select the required EBS volume and take a snapshot as the backup.

Step3: Modify the selected volume to the required size. Here in this example we are expanding an EBS having size 8G to 16G.

Step4: Connect to the EC2 instance as root via ssh.

Step5: Check the disk layout.

#lsblk

NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1       259:1    0  16G  0 disk
└─nvme0n1p1   259:2    0   8G  0 part /

Here the root volume /dev/nvme0n1, has a partition, /dev/nvme0n1p1. The current size of this partition is 8G and we can extent this to 16G.

Step6: Extend the partition.

#sudo growpart /dev/nvme0n1 1

Step7: Check the disk layoyt again.

#lsblk

NAME          MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1       259:1    0  16G  0 disk
└─nvme0n1p1   259:2    0  16G  0 part /

Step8: Verify the size of the file system.

#df -h

Filesystem       Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   8.0G  1.6G  6.5G  20% /

Here it can be noticed that, we need to extend the filesystem.

Step9: Run the following command to extend the filesystem.

#sudo resize2fs /dev/nvme0n1p1

Step10: Verify the size of the filesystem.

#df -h
Filesystem       Size  Used Avail Use% Mounted on
/dev/nvme0n1p1    16G  1.6G   15G  10% /

That's all…