Volume size from `8 GiB` to `12 GiB

Dear Team, I followed this question but unable to expand 12GIB for

This instance, crucial for development activities, is named devops-ec2 and currently has an attached volume of 8 GiB. To accommodate the increasing data requirements, the storage needs to be expanded to 12 GiB. This change should ensure that the expanded space is immediately available for use within the instance without disrupting ongoing activities.

  1. Identify Volume: Find the volume attached to the devops-ec2 instance.
  2. Expand Volume: Increase the volume size from 8 GiB to 12 GiB.
  3. Reflect Changes: Ensure the root (/) partition within the instance reflects the expanded size from 8 GiB to 12 GiB.
  4. SSH Access: Use the key pair located at /root/devops-keypair.pem on the aws-client host to SSH into the EC2 instance.

It looks like you have not done part 3 of the question.

Expanding the EBS volume does not mean that the root partition will immediately use it. You need to tell it to use it - which tests your Linux SA skills.

  1. Use fdisk to expand the root partition to use the newly added space.
  2. Use resize2fs to expand the root file system into the enlarged partition.

Thanks, I was in an impression that it test only AWS related questions, that was good exercise. Let me explain if someone else need steps.
Answer:
To expand the root (/) partition and file system on my EC2 Ubuntu instance after increasing the EBS root volume size from aws console, follow these steps, my ec2 filesystem is xfs.
1.connect via ssh and Check the current size of root fs → df -hT
2.Check if the volume has been resized by AWS → sudo growpart /dev/xvda 1
3.extend the XFS file system → sudo xfs_growfs /
4. verify again → df -hT