请参考官方的文档:https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
[ec2-user@ip-172-31-26-179 ~]$ sudo df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 384K 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/nvme0n1p1 xfs 20G 1.4G 19G 7% /
tmpfs tmpfs 389M 0 389M 0% /run/user/1000
[ec2-user@ip-172-31-26-179 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 30G 0 disk
|-nvme0n1p1 259:1 0 20G 0 part /
`-nvme0n1p128 259:2 0 1M 0 part
[ec2-user@ip-172-31-26-179 ~]$ sudo growpart /dev/nvme0n1 1
CHANGED: partition=1 start=4096 old: size=41938911 end=41943007 new: size=62910431 end=62914527
[ec2-user@ip-172-31-26-179 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 30G 0 disk
|-nvme0n1p1 259:1 0 30G 0 part /
`-nvme0n1p128 259:2 0 1M 0 part
[ec2-user@ip-172-31-26-179 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 384K 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/nvme0n1p1 20G 1.4G 19G 7% /
tmpfs 389M 0 389M 0% /run/user/1000
[ec2-user@ip-172-31-26-179 ~]$ sudo xfs_growfs -d /
meta-data=/dev/nvme0n1p1 isize=512 agcount=11, agsize=524159 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1 spinodes=0
data = bsize=4096 blocks=5242363, 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
data blocks changed from 5242363 to 7863803
[ec2-user@ip-172-31-26-179 ~]$ df -Th
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 384K 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/nvme0n1p1 xfs 30G 1.4G 29G 5% /
tmpfs tmpfs 389M 0 389M 0% /run/user/1000