Extending Linux File System After Resizing the Volume – EC2

From Apoyar Wiki
Jump to navigation Jump to search

Extend a Linux File System After Resizing the Volume – EC2


(This Task has to be done only after the Prior approval from client as this is Costing for Client)

To Increase the storage of any of the EC2 Instance -

- Login into AWS Console

- Go to EC2 Instances

- Click on the Instance

you will the details of the instance in the bottom i.e., Details, Security, Storage networking Etc


- Click on Storage and There you find the Storage capacity of the EC2 instance in GIB’s.

If you want to increase the volume

- Click on Volume ID

- Go to Actions

- Select Modify Volume

- Give the Size you want to increase in GIB’s

- Click Modify

(Note: It take More time Depending on the Volume Increased)

For Reference: Please Go Through the Link in Amazon Docs for Clear Understanding.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html


Now Connect to Server


To verify the file system and type for each volume, use the df -hT command.

df -hT


To check whether the volume has a partition that must be extended, use the lsblk command to display information about the NVMe block devices attached to your instance.

lsblk


For volumes that have a partition, such as the root volume shown in the previous step, use the growpart command to extend the partition. Notice that there is a space between the device name and the partition number

growpart /dev/nvme0n1 1


To extend the file system on each volume, use the resize2fs command

resize2fs /dev/nvme0n1p1


To verify that each file system reflects the increased volume size, use the df -h command again.

df -h


(Root Partition Alerts on Nagios would be based on the volume of the Instances)