First login to the AWS console , go to the ec2 instances , select the required instance , click on ‘Storage’ and click on the ‘Volume id’ . Now select actions and choose ‘modify volume’ , increase the volume and save. Here, I have added 30G which means I am modifying my volume from default 16G to 30G . Please note the 30G is not adding to the existing 16G , its modifying the existing 16G to 30G
![](https://techienix.com/wp-content/uploads/2022/12/image-3.png)
Now we need to extend the partition to add this extra storage to the root partition . SSH to the linux instance , and run a lsblk
![](https://techienix.com/wp-content/uploads/2022/12/image.png)
Here you can see the newly added 30G but its not added to to the root partition . Now , run the growpart command ,
![](https://techienix.com/wp-content/uploads/2022/12/image-1.png)
Run lsblk again and you can see the total volume increased to 30G .
![](https://techienix.com/wp-content/uploads/2022/12/image-2.png)
Now we need to extend the filesystem , run the below command and you will see the root file system is still 16G
df -hT
![](https://techienix.com/wp-content/uploads/2022/12/image-4.png)
The commands to extend the file system differ depending on the file system type. For eg: the XFS file system needs the xfs_growfs command and specify the mount point of the file system . But for our ext4 FS the below command is needed.
resize2fs /dev/xvda1
![](https://techienix.com/wp-content/uploads/2022/12/image-5.png)
Run df -hT again
![](https://techienix.com/wp-content/uploads/2022/12/image-6.png)
Leave a Reply