Aws EC2 Disk Expansion

First, in the aws website control panel, right-click EBS directly, and then manually set the size of EBS. After setting, you can view the progress in the EBS list. When the progress reaches 100%, execute the following command:

1, sudo lsblk (View existing volume and partition information)

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  300G  0 disk 
└─xvda1 202:1    0  100G  0 part /

2, sudo growpart /dev/xvda 1

CHANGED: partition=1 start=4096 old: size=209711071 end=209715167 new: size=629141471 end=629145567

3, sudo resize2fs /dev/xvda1

resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/xvda1
Couldn't find valid filesystem superblock.

4, After reporting the error, execute the following command:

sudo xfs_growfs /dev/xvda1

meta-data=/dev/xvda1             isize=512    agcount=51, agsize=524159 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1 spinodes=0
data     =                       bsize=4096   blocks=26213883, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

5, Check again with sudo lsblk, the capacity has been successfully expanded

NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  300G  0 disk 
└─xvda1 202:1    0  300G  0 part /

so that, you can see the partition xvda1 reached 300G.