添加一个pv到vg后,误删新加入的pv,报 pv * not found or rejected by a filter

问题如下

将某一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和删除东西有关,所以我们重点关注这两个命令

添加一个pv到vg后,误删新加入的pv,报 pv * not found or rejected by a filter

经分析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选项

添加一个pv到vg后,误删新加入的pv,报 pv * not found or rejected by a filter

再看一下,已经恢复正常了

添加一个pv到vg后,误删新加入的pv,报 pv * not found or rejected by a filter

上一篇:Java对象初始化详解(转)


下一篇:特稿 | OceanBase 连破纪录:蚂蚁技术人的砥砺前行