引用原文链接:   https://blog.csdn.net/k1210228840/article/details/89022398

 

1.从vmware设置那里直接手动扩容10G。linux本身只有20G。

2.查看硬盘。需要扩容的硬盘是 /dev/sda,可看到总容量大约30G,但已用的大约20G。

centos7.4虚拟机扩容方法

3.开始扩容

centos7.4虚拟机扩容方法

centos7.4虚拟机扩容方法

4.重启系统 reboot

5.查看当前系统类型为xfs

centos7.4虚拟机扩容方法

6.查看新增磁盘 fdisk -l ,为/dev/sda3

centos7.4虚拟机扩容方法

7.创建文件系统 mkfs.xfs /dev/sda3

centos7.4虚拟机扩容方法

8.进入lvm。

8.1首先创建PV pvcreate /dev/sda3

8.2查看pv,pvdisplay。可看到有新增的pv了

centos7.4虚拟机扩容方法

8.3 pv加入vg。首先查看当前VG的lv path。vg name 为centos

lvdisplay

centos7.4虚拟机扩容方法

8.4 pv 加入vg

vgextend centos /dev/sda3

centos7.4虚拟机扩容方法

8.5调整centos最大容量。本身大约18G,现在增加10G。所以最大为28G./dev/centos/root 为上面查询的lv path

lvextend -L 28G /dev/centos/root   

centos7.4虚拟机扩容方法

28G执行失败,需要缩小空间。最终缩小到26.8G。或者使用, lvextend -l +100%free /dev/centos/root

centos7.4虚拟机扩容方法

centos7.4虚拟机扩容方法

9.重新调整系统大小。本例中是xfs文件系统使用xfs_growfs命令调整,若其他文件系统,如ext4使用resize2fs命令,注意区分。

xfs_growfs /dev/centos/root

centos7.4虚拟机扩容方法

10.查看系统大小df -lh。可以看到从原来的20G到27G。

centos7.4虚拟机扩容方法

 
 

相关文章:

  • 2021-12-17
  • 2021-12-26
  • 2021-06-14
  • 2021-06-07
  • 2021-05-27
  • 2021-11-26
  • 2021-04-27
  • 2021-04-08
猜你喜欢
  • 2021-12-21
  • 2021-06-09
  • 2021-10-17
  • 2022-02-03
  • 2021-06-07
相关资源
相似解决方案