因此,我遇到了磁盘故障,并将 LV 从故障磁盘移动到新的 PV。一些 LV 移动成功,一些没有。之后我最终处于以下状态:- 两个锁定的 LV - 卷组缺少 PV
当我尝试删除 PV 时,我得到:
vgreduce --removemissing --force vg3
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Removing partial LV var.
Can't remove locked LV var
lvremove -fff vg3/var
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Can't remove locked LV var
pvmove --abort
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Cannot change VG vg3 while PVs are missing.
Consider vgreduce --removemissing.
Skipping volume group vg3
我还尝试执行 vcfgbackup,然后在编辑锁后恢复,但无济于事:
vgcfgrestore --force vg3
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Cannot restore Volume Group vg3 with 1 PVs marked as missing.
Restore failed.
所以我更进一步,将磁盘插回去 - 它失败了,但可以检测到一段时间。
vgreduce --removemissing vg3
/dev/vg3/var: read failed after 0 of 4096 at 9638445056: Input/output error
/dev/vg3/var: read failed after 0 of 4096 at 9638502400: Input/output error
WARNING: Partial LV var needs to be repaired or removed.
WARNING: Partial LV pvmove1 needs to be repaired or removed.
There are still partial LVs in VG vg3.
To remove them unconditionally use: vgreduce --removemissing --force.
Proceeding to remove empty missing PVs.
lvremove -fff vg3/var
/dev/vg3/var: read failed after 0 of 4096 at 9638445056: Input/output error
/dev/vg3/var: read failed after 0 of 4096 at 9638502400: Input/output error
Can't remove locked LV var
pvmove --abort
/dev/vg3/var: read failed after 0 of 4096 at 9638445056: Input/output error
/dev/vg3/var: read failed after 0 of 4096 at 9638502400: Input/output error
Cannot change VG vg3 while PVs are missing.
Consider vgreduce --removemissing.
Skipping volume group vg3
而此刻我已经没有主意了。
答案1
如同无法删除卷组,通过创建具有相同 uuid 的临时 pv 解决了此问题:
UUID="RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP" # from question
dd if=/dev/zero of=/tmp/tmp.raw bs=1M count=100
losetup -f
losetup /dev/loop0 /tmp/tmp.raw
pvcreate --norestorefile -u $UUID /dev/loop0 # it has arisen!
killall lvmetad # so it stops complaining about duplicate uuids
pvremove /dev/loop0 # a clean removal
losetup -D
pvscan --cache # to restart lvmetad
如果需要的话,用vgreduce
等等调味。