centos7虚拟机增加其中一个LVM目录的容量

1.如图centos_yeshuai-root 是LVM分区挂载在/目录下容量是37GB,假设他现在空间不够了,对其扩容10GB的容量。


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量

这里用命令查看centos7是看不到新加的10GB硬盘


                                            centos7虚拟机增加其中一个LVM目录的容量

3.重启虚拟机(注意,vmware文件系统数据系统的区别和联系 workstation需要重启,但是fusioncompute和v虚拟化软件mware esxi虚拟化是不需要重启的)


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量

4.格式化/dev/sdb1,格式化前,先查看/dev/sda是什么格式的


                                            centos7虚拟机增加其中一个LVM目录的容量

如图,是xfs格式的。所以我们也格式化重启术士的人生樱花动漫成xfs.


                                            centos7虚拟机增加其中一个LVM目录的容量

将新加的硬盘加入已有的卷组中,实现扩容:


                                            centos7虚拟机增加其中一个LVM目录的容量

查看是否创建成功:


                                            centos7虚拟机增加其中一个LVM目录的容量

查看已存在的vg组:


                                            centos7虚拟机增加其中一个LVM目录的容量

将新的PV添加到VG中:


                                            centos7虚拟机增加其中一个LVM目录的容量

然后centos,对lv 进扩容,先查看一下LV的名称:

[root@yeshuai ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos_yeshuai/root
LV Name root
VG Name centos_yeshuai
LV UUID w5lVIb-gl7h-5WEU-UHPU-VhTp-yLct-HlWOtM
LV Write Access read/write
LV Creation host, time yeshuai, 2021-11-29 15:27:40 +0800
LV Status available
# open 1
LV Size 36.99 GiB
Current LE 9470
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

--- Logical volume ---
LV Path /dev/centos_yeshuai/swap
LV Name swap
VG Name centos_yeshuai
LV UUID Ne55F9-3hD7-ro53-Jb1B-Rmtr-ab7g-Cz4I0W
LV Write Access read/write
LV Creation host, time yeshuai, 2021-11-29 15:27:40 +0800
LV Status available
# open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

这里要扩容的是/dev/centos_yeshuai/roolinux操作系统基础知识t 目录,


                                            centos7虚拟机增加其中一个LVM目录的容量

调整文件系统的大小:


                                            centos7虚拟机增加其中一个LVM目录的容量

由于centos7的 /dev/centos_yeshua重启i/root 是xfs文件系统,所以使用命令xfs_growfs (可以查看/etc/fstab 得到文件系统类型),如果是其他的lv 其文件系统为 ext4 则使用 resize2fs 命令.


                                            centos7虚拟机增加其中一个LVM目录的容量


                                            centos7虚拟机增加其中一个LVM目录的容量

扩容成功!!!

扩展阅读:

​https://www.cnblogs.com/Sung系统运维工程eek/p/9084510.html​​