Cannot extend the file system after increase eb2 volume size

0

I have an ec2 instance that has only 1 volume and I just increased the volume from 8G to 16G. After modification the volume, I can see the volume is 16GB from the console (volume type is gp2). Now I am following the doc to extend the file system but looks there is no extra volume for me to extend my file system, /dev/xvda1 is the old one.

Filesystem Type Size Used Avail Use% Mounted on udev devtmpfs 478M 0 478M 0% /dev tmpfs tmpfs 98M 516K 98M 1% /run /dev/xvda1 ext4 7.7G 6.4G 897M 88% / tmpfs tmpfs 488M 0 488M 0% /dev/shm tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock /dev/xvda15 vfat 124M 11M 114M 9% /boot/efi tmpfs tmpfs 98M 0 98M 0% /run/user/1000

walter
asked 8 months ago295 views
2 Answers
1

You need to amend the partition table for the underlying disk, basically Linux thinks that the end of the disk is 8GB after the start, this needs to be updated so that the at 16GB (it's more convoluted, but that's the gist of it). The tool to use for this bit would be fdisk, gparted or growpart (whichever you are most comfortable with using).

After that, use resize2fs to grow the ext4 filesystem (for reference, if the filesystem is xfs the command would be xfs_growsfs).

Full details of all of these steps are here https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html

profile picture
EXPERT
Steve_M
answered 8 months ago
0

If you have successfully resized the EBS volume attached to your EC2 instance, You need to extend the file system on the instance to utilize the additional space that you've gained.

Try the below:

  1. Check the Current File System: Before extending the file system, it's good to check the current state. You've done that in your provided output. The current file system is mounted on /dev/xvda1 and is of type ext4.

  2. Resize the File System: You can use the resize2fs command to resize the ext4 file system to take advantage of the newly added space. Replace /dev/xvda1 with your actual file system device name.

    sudo resize2fs /dev/xvda1

    This command will automatically extend the file system to utilize the entire available space on the volume.

  3. Verify the Result: After running the resize command, you can check the new size of your file system:

    df -h

    The output should show that your root partition (/) now has more available space.

Your system should now be using the full 16GB of your EBS volume. Keep in mind that these steps assume you're using a Linux-based operating system, specifically an ext4 file system. If you're using a different file system or operating system, the steps might vary slightly. Always make sure to have a backup of your important data before performing these kinds of operations, just in case.

Additionally, for Windows-based instances or other file system types, the process would be different. If that's the case, please provide more information, and I can guide you accordingly.

profile picture
answered 8 months ago
profile picture
EXPERT
reviewed 8 months ago
profile pictureAWS
EXPERT
reviewed 8 months ago
  • Agreed with Gabriel: resize2fs is the way to go

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions