Linux LVM学习总结——删除PV遇到的问题小结
作者:互联网
Linux LVM学习总结——删除PV遇到的问题小结
[root@mylnx01 ~]# pvscan
PV /dev/sdi2 VG VolGroup07 lvm2 [201.36 GB / 0 free]
PV /dev/sdj9 VG VolGroup07 lvm2 [47.63 GB / 47.63 GB free] #free不为0,这个表示从卷组中删除了逻辑卷
PV /dev/sdh1 VG VolGroup06 lvm2 [270.00 GB / 0 free]
PV /dev/sdj8 VG VolGroup06 lvm2 [41.91 GB / 41.91 GB free]
PV /dev/sdf5 VG VolGroup05 lvm2 [179.97 GB / 0 free]
PV /dev/sdg5 VG VolGroup05 lvm2 [79.97 GB / 0 free]
PV /dev/sdf2 VG VolGroup05 lvm2 [25.00 GB / 0 free]
PV /dev/sdj7 VG VolGroup05 lvm2 [45.25 GB / 45.25 GB free]
PV /dev/sdd1 VG VolGroup08 lvm2 [285.00 GB / 4.00 MB free]
PV /dev/sdc5 VG VolGroup02 lvm2 [199.97 GB / 0 free]
PV /dev/sdc2 VG VolGroup02 lvm2 [29.97 GB / 0 free]
PV /dev/sdj5 VG VolGroup02 lvm2 [36.12 GB / 36.12 GB free]
PV /dev/sdb5 VG VolGroup01 lvm2 [79.97 GB / 0 free]
PV /dev/sdb2 VG VolGroup01 lvm2 [9.97 GB / 0 free]
PV /dev/sdj3 VG VolGroup01 lvm2 [15.09 GB / 15.09 GB free]
PV /dev/sda2 VG VolGroup00 lvm2 [51.88 GB / 0 free]
PV /dev/sde5 VG VolGroup00 lvm2 [59.97 GB / 0 free]
PV /dev/sda3 VG VolGroup00 lvm2 [27.97 GB / 0 free]
PV /dev/sdj1 VG VolGroup00 lvm2 [20.03 GB / 20.03 GB free]
PV /dev/sdj2 VG VolGroup00 lvm2 [1.97 GB / 1.97 GB free]
PV /dev/sdj6 lvm2 [41.92 GB] #注意:这个表示PV已经从VG里面删除了,也就是说VG已经不包含这个PV了
Total: 21 [1.71 TB] / in use: 20 [1.67 TB] / in no VG: 1 [41.92 GB]
移除/删除PV前,必须先使用vgreduce命令从卷组中删除一个或多个物理卷来缩小卷组。 否则会遇到下面错误:
[root@mylnx01 ~]# pvremove /dev/sdj9
Can't pvremove physical volume "/dev/sdj9" of volume group "VolGroup07" without -ff
正确的做法如下:
[root@mylnx01 ~]# vgreduce VolGroup07 /dev/sdj9
Removed "/dev/sdj9" from volume group "VolGroup07"
[root@mylnx01 ~]# pvremove /dev/sdj9
Labels on physical volume "/dev/sdj9" successfully wiped
使用vgreduce命令从卷组中删除一个或多个物理卷来缩小卷组后,你使用pvscan命令,就能看到红色部分的内容(注释部分内容)
[root@mylnx01 ~]# pvscan
PV /dev/sdi2 VG VolGroup07 lvm2 [201.36 GB / 0 free]
PV /dev/sdh1 VG VolGroup06 lvm2 [270.00 GB / 0 free]
PV /dev/sdj8 VG VolGroup06 lvm2 [41.91 GB / 41.91 GB free]
PV /dev/sdf5 VG VolGroup05 lvm2 [179.97 GB / 0 free]
PV /dev/sdg5 VG VolGroup05 lvm2 [79.97 GB / 0 free]
PV /dev/sdf2 VG VolGroup05 lvm2 [25.00 GB / 0 free]
PV /dev/sdj7 VG VolGroup05 lvm2 [45.25 GB / 45.25 GB free]
PV /dev/sdd1 VG VolGroup08 lvm2 [285.00 GB / 4.00 MB free]
PV /dev/sdc5 VG VolGroup02 lvm2 [199.97 GB / 0 free]
PV /dev/sdc2 VG VolGroup02 lvm2 [29.97 GB / 0 free]
PV /dev/sdj5 VG VolGroup02 lvm2 [36.12 GB / 36.12 GB free]
PV /dev/sdb5 VG VolGroup01 lvm2 [79.97 GB / 0 free]
PV /dev/sdb2 VG VolGroup01 lvm2 [9.97 GB / 0 free]
PV /dev/sdj3 VG VolGroup01 lvm2 [15.09 GB / 15.09 GB free]
PV /dev/sda2 VG VolGroup00 lvm2 [51.88 GB / 0 free]
PV /dev/sde5 VG VolGroup00 lvm2 [59.97 GB / 0 free]
PV /dev/sda3 VG VolGroup00 lvm2 [27.97 GB / 0 free]
PV /dev/sdj1 VG VolGroup00 lvm2 [20.03 GB / 20.03 GB free]
PV /dev/sdj2 VG VolGroup00 lvm2 [1.97 GB / 1.97 GB free]
PV /dev/sdj6 lvm2 [41.92 GB]
PV /dev/sdj9 lvm2 [47.63 GB] #表示pv已经从物理卷组中移除。
Total: 21 [1.71 TB] / in use: 19 [1.62 TB] / in no VG: 2 [89.55 GB]
那么如何找出PV是那个VG呢?或者我怎么找出当前PV对应的VG关系呢? 正确的做法和流程如下:
[root@mylnx01 ~]# pvdisplay /dev/sdj8
--- Physical volume ---
PV Name /dev/sdj8
VG Name VolGroup06 #这个VG就是PV对应的VG
PV Size 41.92 GB / not usable 3.64 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 10730
Free PE 10730
Allocated PE 0
PV UUID YRB1Uf-d6O8-JEe0-fccZ-VllI-Hi9B-vMu3y7
[root@mylnx01 ~]#
[root@mylnx01 ~]# vgreduce VolGroup06 /dev/sdj8
Removed "/dev/sdj8" from volume group "VolGroup06"
[root@mylnx01 ~]# pvremove /dev/sdj8
Labels on physical volume "/dev/sdj8" successfully wiped
标签:free,PV,VG,lvm2,dev,GB,Linux,LVM 来源: https://www.cnblogs.com/kerrycode/p/12807481.html