Centos7 给Lvm磁盘扩容
扩容之前
![](https://img2020.cnblogs.com/blog/1542546/202005/1542546-20200521114824133-822408447.png)
- 将一块磁盘安装上服务器
[root@lanyi ~]# lsblk 列出所有可用块设备的信息
每添加一块磁盘/dev/下就会出现一个sd* 依次按abcdefg排序
二、让新添加的磁盘支持lvm技术
[root@lanyi ~]# pvcreate /dev/sdf Physical volume "/dev/sdf" successfully created. [root@lanyi ~]# pvdisplay # 查看是否有/dev/sdf 此硬件设备的信息
PV Name /dev/sdf VG Name PV Size 1.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID SJSNcZ-xBbE-Y7Iu-TGGd-A3HT-xHbU-YFtaM
- 把硬件设备添加到 centos (此卷组是需要扩容的卷组,之前就有的)卷组中,然后查看卷组状态
[root@lanyi ~]# vgextend centos /dev/sdf Volume group "centos" successfully extended [root@lanyi ~]# vgdisplay
![](https://img2020.cnblogs.com/blog/1542546/202005/1542546-20200521114914015-768199370.png)
、对逻辑卷centos-1进行扩容
[root@lanyi ~]# lvextend -l +100%FREE /dev/centos/centos-1 # 注意,我这个centos-1 是我之前创建的一个Lvm磁盘名叫centos-1 默认是root 我是新增的 [root@lanyi ~]# xfs_growfs /dev/centos/centos-1 对硬件设备进行格式化,使其产生效果 [root@lanyi ~]# df -h 此时利用此命令完成扩容
![](https://img2020.cnblogs.com/blog/1542546/202005/1542546-20200521114942922-998442725.png)
拓展;
建议完lvm之后需要挂载到/etc/fstab文件中 如下
/dev/mapper/centos-centos--1 /linuxprobe xfs defaults 0 0