1、首先通过下列命令列出设备详情,可以看到红色框起来的部分有160G,需要把新增的20G扩容到根目录(139.9)上
bash
lsblk

查看文件系统
bash
df -h

2.执行sudo growpart /dev/xvda 1即可把20G的空间扩容到根目录上

扩容成功
但是可以看到并未生效
3.列出文件系统格式
bash
df -T -h

4.扩展分区文件系统(不同文件系统类型,用不同扩展命令)
bash
sudo resize2fs /dev/root

效果如下