存储磁盘个数到达上限后VG的在线扩容的方法
Red hat 6.2
Oracle 11.2.0.4
某存储最多能挂载11块磁盘到某liunx系统,现在已经使用10块,后续liunx系统还需要扩容,分配磁盘数已经到限制,需要处理
经过登录系统了解到存储还好使用了LVM管理。
(在线测试时ORACLE一直在运行)
1.pvremove(在线加入一个大容量的PV,然后移出一些小的PV)
a.新建一大容量PV并加入到现有VG
[root@localhost /]# pvcreate /dev/xvdh
Writing physical volume data to disk "/dev/xvdh"
Physical volume "/dev/xvdh" successfully created
[root@localhost /]# vgextend vg01 /dev/xvdh
Volume group "vg01" successfully extended
[root@localhost /]# pvscan
PV /dev/xvdf VG vg01 lvm2 [10.00 GiB / 0 free]
PV /dev/xvdg VG vg01 lvm2 [10.00 GiB / 4.99 GiB free]
PV /dev/xvdh VG vg01 lvm2 [30.00 GiB / 30.00 GiB free]
PV /dev/xvda2 VG VolGroup lvm2 [59.51 GiB / 0 free]
PV /dev/xvde1 VG VolGroup lvm2 [120.00 GiB / 0 free]
Total: 5 [229.49 GiB] / in use: 5 [229.49 GiB] / in no VG: 0 [0 ]
b.把小的PV里的数据在线移出
[root@localhost /]# pvmove -i 1 /dev/xvdf
/dev/xvdf: Moved: 0.0%
/dev/xvdf: Moved: 1.0%
…………
/dev/xvdf: Moved: 99.0%
/dev/xvdf: Moved: 100.0%
[root@localhost /]# pvscan
PV /dev/xvdf VG vg01 lvm2 [10.00 GiB / 10.00 GiB free]
PV /dev/xvdg VG vg01 lvm2 [10.00 GiB / 4.99 GiB free]
PV /dev/xvdh VG vg01 lvm2 [30.00 GiB / 20.00 GiB free]
PV /dev/xvda2 VG VolGroup lvm2 [59.51 GiB / 0 free]
PV /dev/xvde1 VG VolGroup lvm2 [120.00 GiB / 0 free]
Total: 5 [229.49 GiB] / in use: 5 [229.49 GiB] / in no VG: 0 [0 ]
c.将小的PV从卷组中卸载
[root@localhost /]# vgreduce vg01 /dev/xvdf
Removed "/dev/xvdf" from volume group "vg01"
[root@localhost /]# pvremove /dev/xvdf
Labels on physical volume "/dev/xvdf" successfully wiped
----------------------------------------------------------------------------------------
2.pvresize(在线存储级直接增加磁盘大小然后pvresize刷新)
a.在存储控制台加大磁盘大小
b.刷新PV容量发现容量已经变大
[root@localhost /]# pvresize -v /dev/xvdh
[root@localhost ~]# pvscan
PV /dev/xvdg VG vg01 lvm2 [14.00 GiB / 0 free]
PV /dev/xvdh VG vg01 lvm2 [51.00 GiB / 2.00 GiB free]
PV /dev/xvda2 VG VolGroup lvm2 [59.51 GiB / 0 free]
PV /dev/xvde1 VG VolGroup lvm2 [120.00 GiB / 0 free]
Total: 4 [244.50 GiB] / in use: 4 [244.50 GiB] / in no VG: 0 [0 ]