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
질문됨 일 년 전388회 조회
2개 답변
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
전문가
Steve_M
답변함 일 년 전
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
답변함 일 년 전
profile picture
전문가
검토됨 일 년 전
profile pictureAWS
전문가
검토됨 일 년 전
  • Agreed with Gabriel: resize2fs is the way to go

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠