场景:有一个文件系统空间不足,需要扩容空间,准备工作中发现,文件系统对应LV所在VG 的"Free PE" 值是0,VG已经没有空间了,因此要先扩容VG,再扩容LV,但是扩容VG发现“MAX PV”已经到达限制了再增加PV,必需要先增加“MAX PV”具体信息如下:
#vgdisplay /dev/datavg
--- Volume groups ---
VG Name /dev/datavg
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 1
Open LV 1
Max PV 20
Cur PV 20
Act PV 20
Max PE per PV 42000
VGDA 40
PE Size (Mbytes) 256
Total PE 40580
Alloc PE 40580
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 1.0
VG Max Size 210000g
VG Max Extents 840000
发现这个VG是用1.0的版本,因此有两个办法解决这个问题,一种是通过vgmodify 来修改“MAX PV”,另一种是升级VG 1.0到期2.0,这里主要介绍VG 1.0如何升级到2.0.
升级前准备:
- 从VG1.0 升级到2.0 要去将datavg去激活,所在只要涉及到这个VG的业务,都需要停下来;
- 备份datavg相关配置信息;最好是备份VG所涉及文件系统所有数据,以防万一
vgexport -p -v -s -m datavg.map /dev/datavg
vgcfgbackup /dev/datavg
升级实施:
先去挂载datavg相关的所有文件系统,然后执行;
#vgchange -a n /dev/datavg
Volume group "/dev/datavg" has been successfully changed.
#vgversion -V 2.0 /dev/datavg
Performing "vgchange -a y -l -p -s /dev/datavg" to collect data
Activated volume group.
Volume group "/dev/datavg" has been successfully activated.
Warning: Volume Group version 2.0 does not support bad block
relocation. The bad block relocation policy of all logical volumes
will be set to NONE.
Old Volume Group configuration for "/dev/datavg" has been saved in "/etc/lvmconf/vgversion_datavg/datavg_1.0.conf"
Deactivating Volume Group "/dev/datavg"
Volume group "/dev/datavg" has been successfully deactivated.
New Volume Group configuration for "/dev/datavg" has been saved in "/etc/lvmconf/vgversion_datavg/datavg_2.0.conf"
Removing the Volume Group /dev/datavg from /etc/lvmtab
Applying the configuration to all Physical Volumes from "/etc/lvmconf/vgversion_datavg/datavg_2.0.conf"
Volume Group configuration has been restored to /dev/rdisk/disk44
Volume Group configuration has been restored to /dev/rdisk/disk43
Volume Group configuration has been restored to /dev/rdisk/disk42
Volume Group configuration has been restored to /dev/rdisk/disk41
Volume Group configuration has been restored to /dev/rdisk/disk40
Volume Group configuration has been restored to /dev/rdisk/disk39
Volume Group configuration has been restored to /dev/rdisk/disk38
Volume Group configuration has been restored to /dev/rdisk/disk37
Volume Group configuration has been restored to /dev/rdisk/disk36
Volume Group configuration has been restored to /dev/rdisk/disk35
Volume Group configuration has been restored to /dev/rdisk/disk34
Volume Group configuration has been restored to /dev/rdisk/disk33
Volume Group configuration has been restored to /dev/rdisk/disk32
Volume Group configuration has been restored to /dev/rdisk/disk31
Volume Group configuration has been restored to /dev/rdisk/disk30
Volume Group configuration has been restored to /dev/rdisk/disk29
Volume Group configuration has been restored to /dev/rdisk/disk28
Volume Group configuration has been restored to /dev/rdisk/disk27
Volume Group configuration has been restored to /dev/rdisk/disk26
Volume Group configuration has been restored to /dev/rdisk/disk25
Creating the Volume Group of version 2.0 with minor number 0x1000.
Adding the Volume Group /dev/datavg to /etc/lvmtab_p
Original Volume Group Version was 1.0
New Volume Group Version is 2.0
Volume Group version has been successfully changed to 2.0
Volume Group configuration for /dev/datavg has been saved in /etc/lvmconf/datavg.conf
##vgchange -a y /dev/datavg
Activated volume group.
Volume group "/dev/datavg" has been successfully changed.
#vgdisplay /dev/datavg
--- Volume groups ---
VG Name /dev/datavg
VG Write Access read/write
VG Status available
Max LV 511
Cur LV 1
Open LV 1
Max PV 511
Cur PV 20
Act PV 20
Max PE per PV 65536
VGDA 40
PE Size (Mbytes) 256
Total PE 40580
Alloc PE 40580
Free PE 0
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0
VG Version 2.0
VG Max Size 210000g
VG Max Extents 840000
此时就成功的增加了Max PV的值到511了。