問題如下
將某一pv加入vg
vgextend cl /dev/xvdb1
然后進入fdisk將xvdb1分區刪掉,重新創建pv
使用lvdisplay報警告
[root@localhost ~]# lvdisplay
WARNING: Device /dev/xvdb1 has size of 6291456 sectors which is smaller than corresponding PV size of 20969472 sectors. Was device resized?
One or more devices used as PVs in VG cl have changed sizes.
使用其他命令檢查也會報錯
[root@localhost ~]# vgscan
Reading volume groups from cache.
WARNING: Device for PV fNjF3j-gTVO-fkOV-2Cfe-MxSg-6uFo-v6hlZJ not found or rejected by a filter.
Found volume group "cl" using metadata type lvm2
[root@localhost ~]# vgck
Couldn't find device with uuid fNjF3j-gTVO-fkOV-2Cfe-MxSg-6uFo-v6hlZJ.
The volume group is missing 1 physical volumes.
[root@localhost ~]# pvdisplay
WARNING: Device for PV fNjF3j-gTVO-fkOV-2Cfe-MxSg-6uFo-v6hlZJ not found or rejected by a filter.
--- Physical volume ---
PV Name /dev/xvda2
VG Name cl
PV Size 99.80 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25549
Free PE 0
Allocated PE 25549
PV UUID beHW5L-tqXd-TwBF-ddfm-ouJn-OQbk-gYznOz
--- Physical volume ---
PV Name [unknown] #這里顯示未知說明有問題
VG Name cl
PV Size 10.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 2559
Free PE 2559
Allocated PE 0
PV UUID fNjF3j-gTVO-fkOV-2Cfe-MxSg-6uFo-v6hlZJ
解決方法如下
先嘗試根據系統命令看一下有沒有合適的命令
從lvdisplay那里我們可以推測,vg有問題
所以我們來看一下vg開頭的命令有哪些
可以看到vgck,vgscan都可以用來檢查vg,其中vgremove和vgreduce和刪除東西有關,所以我們重點關注這兩個命令
經分析vgremove 是用來直接刪掉vg的,所以我們試着來看一下vgreduce
[root@localhost ~]# vgreduce --help
vgreduce: Remove physical volume(s) from a volume group
vgreduce
[-a|--all]
[-A|--autobackup y|n]
[--commandprofile ProfileName]
[-d|--debug]
[-h|--help]
[--mirrorsonly]
[--removemissing]
[--reportformat {basic|json}]
[-f|--force]
[-t|--test]
[-v|--verbose]
[--version]
VolumeGroupName
[PhysicalVolumePath...]
我們嘗試用removemissing選項
再看一下,已經恢復正常了