An Amazon EBS volume is a durable, block-level storage device that you can attach to one instance or to multiple instances at the same time. You can use EBS volumes as primary storage for data that requires frequent updates, such as the system drive for an instance or storage for a database application.
For more related guides read: How to Add an EBS volume to AWS EC2 via the AWS Console and CLI, How to sync S3 Bucket with an EC2 instance and How to grant public access to S3 Bucket using Policy. Follow the below steps to modify a Linux EBS Volume from the Console.
Step 1: Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
– Copy the instance ID from the AWS EC2 Console
– Navigate to Volumes, select the volume to modify (by searching for the instance ID if there are a lot),
– Choose Actions, Modify Volume to the size you desire.
– Now follow the prompts to complete extending the drive and finish
Step 2: Navigate to the Linux Command Prompt
– Modifying volume size has no practical effect until you also extend the volume’s file system to make use of the new storage capacity.
– Note: Use the existing file System to show the existing hard disk space on your instance
[ec2-user ~]$dh -f Filesystem Size Used Avail Use% Mounted on /dev/xvda1 8.0G 943M 6.9G 12% /
or to list the block devices attached to your instance [ec2-user ~]$lsblk
For ext2, ext3, and ext4 file systems, —> [ec2-user ~]$resize2fs /dev/xvdf1
For XFS file system [ec2-user ~]$xfs_growfs -d /mnt
xfs_growfs -d /mnt
My Scenario: To fix increase the file system of xvda1
[ec2-user ~]$growpart /dev/xvda1
The result would be as shown below.
CHANGED: disk=/dev/xvda partition=1: start=4096 old: size=16773086,end=16777182 new: size=73396190,end=73400286
Now use the command below to see if it has taken effect “[ec2-user ~]$ lsblk”
Note: With the command dh -f It might show the previous available space. Simply reboot or initialize it
That’s it for modifying a Linux EBS Volume from the Console. I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.