centos7扩展根目录/

https://www.yuque.com/alipayeut69c4uex/txovd5/cte3uy

现在根目录centos-root可用空间为2.6G

centos7扩展根目录/

 

这是第一块磁盘,快满了

centos7扩展根目录/

 

这是新挂载的磁盘,还没用,没加入到根目录

centos7扩展根目录/

 

下面开始用新磁盘sdb扩展根目录

  • 创建分区 /dev/sdb ,注意选择 8e 也即是 LVM 类型

centos7扩展根目录/

 

这是各种操作

centos7扩展根目录/

 

  • 依次输入n,p,1,回车,回车,t,8e,w

n是创建新分区,t是定义新分区类型,8e是Linux LVM类型的代码,w 完成修改

centos7扩展根目录/

 

  • 输入fdisk -l   看到已经存在分区 /dev/sdb1 了,刚开始输入fdisk -l的时候是没有  设备 ,boot那两行的

centos7扩展根目录/

 

  • 创建 PV

centos7扩展根目录/

 

  • 查看 LV,显示 LV Path 为 /dev/centos/root,VG Name 为 centos

centos7扩展根目录/

 

  • 扩展 VG centos

centos7扩展根目录/

 

  • 扩展 LV /dev/centos/root

centos7扩展根目录/

 

  • 如果系统是用的XFS文件系统,需要要运行以下命令:
xfs_growfs /dev/centos/root

centos7扩展根目录/

 

  • 查看磁盘空间信息,/dev/mapper/centos-root 已经扩充到13G了

centos7扩展根目录/