① Expand the volume size from the AWS EC2 console (2) Expand the disk capacity (partition) in Amazon Linux
EC2 Instance → Volume → Action → Change Volume In my case, I changed the specified volume size from 8GB to 12Gb.
reference Request EBS Volume Changes https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/requesting-ebs-volume-modifications.html
Confirm that the setting of ① is reflected by the lsblk command.
python
# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT   
xvda    202:0    0  12G  0 disk   
┗xvda1   202:1    0   8G  0 part
※ xvda ・ ・ ・ device name xvda1 ・ ・ ・ Represents partition number 1 of xvda
Since the volume size is 12G and the partition size is 8G, it is necessary to expand it.
python
# yum install cloud-utils-growpart
Check if there is a grow part in the package list
python
# rpm -qa | grep cloud
cloud-utils-growpart-0.31-2.amzn2.noarch
Expand partition size with growpart command and reboot
python
# growpart /dev/xvda 1
# reboot
Make sure that the first partition of xvda is extended to 12G
python
# lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT 
xvda    202:0    0  12G  0 disk 
┗xvda1  202:1    0  12G  0 part /
        Recommended Posts