AWS EC2服务器磁盘在线热扩容

0. 服务器用着用着磁盘就满了, 但是业务不能断, 不能以附加的方式挂载磁盘.

Snipaste_2020-09-25_14-38-32.png


1. 登录到aws控制台 --> EC2 --> 复制实例ID --> 磁盘搜索实例ID --> 操作 --> 修改卷

Snipaste_2020-09-25_14-42-39.png
Snipaste_2020-09-25_14-43-16.png


2. 登录到服务器

Snipaste_2020-09-25_14-46-39.png

[[email protected] ~]# growpart /dev/nvme0n1 1
CHANGED: partition=1 start=2048 old: size=62912479 end=62914527 new: size=104855519 end=104857567
[[email protected] ~]# xfs_growfs -d /
meta-data=/dev/nvme0n1p1         isize=512    agcount=16, agsize=524160 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7864059, 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 7864059 to 13106939

3. 扩容成功了, 对在线业务没有任何影响~

Snipaste_2020-09-25_14-52-41.png