![恢复我使用 vgreduce --removemissing 删除的物理卷](https://linux22.com/image/215465/%E6%81%A2%E5%A4%8D%E6%88%91%E4%BD%BF%E7%94%A8%20vgreduce%20--removemissing%20%E5%88%A0%E9%99%A4%E7%9A%84%E7%89%A9%E7%90%86%E5%8D%B7.png)
作为灾难恢复练习,我拔掉了属于镜像逻辑卷一部分的驱动器 (/dev/sda) 的插头。我能够通过以下方式使系统可启动
vgreduce --removemissing --force kubuntu-vg
lvs报告
WARNING: ignoring metadata seqno 118 on /dev/sda5 for seqno 120 on /dev/sdb1 for VG kubuntu-vg.
WARNING: Inconsistent metadata found for VG kubuntu-vg
WARNING: outdated PV /dev/sda5 seqno 118 has been removed in current VG kubuntu-vg seqno 120.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home_lv kubuntu-vg rwi-aor-r- <1.76t 100.00
但现在我想撤消该操作 - 因此我重新插入驱动器,现在我需要将该驱动器作为物理卷重新安装到系统上
物理卷过去是什么样子
pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name kubuntu-vg
PV Size <1.82 TiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 476809
Free PE 16008
Allocated PE 460801
PV UUID X5FdPD-xkae-gXSe-wSbH-ngl7-SiPD-EjeYP6
--- Physical volume ---
PV Name /dev/sdb1
VG Name kubuntu-vg
PV Size <1.82 TiB / not usable 1.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 476810
Free PE 16009
Allocated PE 460801
PV UUID 6XNs0p-k0f3-1Zru-txVO-0AWy-IfWo-4YhGvD
pvdisplay 现在显示什么 - 只有一个物理卷
--- Physical volume ---
PV Name /dev/sdb1
VG Name kubuntu-vg
PV Size <1.82 TiB / not usable 1.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 476810
Free PE 16009
Allocated PE 460801
PV UUID 6XNs0p-k0f3-1Zru-txVO-0AWy-IfWo-4YhGvD
来自这个 golinuxcloud 文档 在 Linux 中恢复 LVM2 分区、PV、VG、LVM 元数据的 5 个简单步骤 我认为我想要运行的命令是带有 --restorefile 选项的 pvcreate 。 golinuxcloud 建议首先在测试模式下运行它
pvcreate --test --uuid "X5FdPD-xkae-gXSe-wSbH-ngl7-SiPD-EjeYP6" --restorefile /etc/lvm/archive/kubuntu-vg_00002-168403895.vg /dev/sda
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
WARNING: Couldn't find device with uuid X5FdPD-xkae-gXSe-wSbH-ngl7-SiPD-EjeYP6.
WARNING: Couldn't find device with uuid 6XNs0p-k0f3-1Zru-txVO-0AWy-IfWo-4YhGvD.
WARNING: ignoring metadata seqno 118 on /dev/sda5 for seqno 120 on /dev/sdb1 for VG kubuntu-vg.
WARNING: Inconsistent metadata found for VG kubuntu-vg
WARNING: outdated PV /dev/sda5 seqno 118 has been removed in current VG kubuntu-vg seqno 120.
Device /dev/sda excluded by a filter.
在我看来,这里阻止成功的是“设备 /dev/sda 被过滤器排除”。对此你该怎么办?
我的命令中引用的备份文件是vgcfgrestore --list kubuntu-vg
这样描述的
File: /etc/lvm/archive/kubuntu-vg_00002-168403895.vg
VG name: kubuntu-vg
Description: Created *before* executing 'vgreduce --removemissing --force kubuntu-vg'
Backup Time: Sun Jan 8 13:34:23 2023