这是一台运行 Fedora 28 的机器,只有一个硬盘。我插入了另一个硬盘,看看能否从中提取数据(不能),但在我将其移除(返回一个驱动器)后,我发现它弄乱了 pv 和 lv 数据:
[root@localhost-live ~]# pvscan
WARNING: Device for PV F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1 not found or rejected by a filter.
PV /dev/sda2 VG vg_debussy lvm2 [931.00 GiB / 0 free]
PV [unknown] VG vg_debussy lvm2 [931.50 GiB / 0 free]
Total: 2 [<1.82 TiB] / in use: 2 [<1.82 TiB] / in no VG: 0 [0 ]
[root@localhost-live ~]# vgscan
Reading volume groups from cache.
WARNING: Device for PV F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1 not found or rejected by a filter.
Found volume group "vg_debussy" using metadata type lvm2
[root@localhost-live ~]# lvs
WARNING: Device for PV F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1 not found or rejected by a filter.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_home vg_debussy -wi-----p- 1.75t
lv_root vg_debussy -wi-a----- 50.00g
lv_swap vg_debussy -wi-ao---- <17.69g
[root@localhost-live ~]# lvscan
WARNING: Device for PV F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1 not found or rejected by a filter.
ACTIVE '/dev/vg_debussy/lv_root' [50.00 GiB] inherit
inactive '/dev/vg_debussy/lv_home' [1.75 TiB] inherit
ACTIVE '/dev/vg_debussy/lv_swap' [<17.69 GiB] inherit
我无法激活 lv_home
原因似乎是具有相同 VG 名称的重复物理卷:
[root@localhost-live ~]# pvdisplay
WARNING: Device for PV F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1 not found or rejected by a filter.
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_debussy
PV Size 931.02 GiB / not usable 24.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 29792
Free PE 0
Allocated PE 29792
PV UUID KSk5KO-Su5d-H8LO-a8t0-s8gH-WdWA-DXQZTr
--- Physical volume ---
PV Name [unknown]
VG Name vg_debussy
PV Size 931.51 GiB / not usable 12.00 MiB
Allocatable yes (but full)
PE Size 32.00 MiB
Total PE 29808
Free PE 0
Allocated PE 29808
PV UUID F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1
这就是我犯错误的地方(按照别人写的据称有效的方法):
[root@localhost-live ~]# vgreduce --removemissing --force vg_debussy
WARNING: Device for PV F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1 not found or rejected by a filter.
WARNING: Removing partial LV vg_debussy/lv_home.
Logical volume "lv_home" successfully removed
Wrote out consistent volume group vg_debussy.
[root@localhost-live ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_debussy
PV Size 931.02 GiB / not usable 24.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 29792
Free PE 27626
Allocated PE 2166
PV UUID KSk5KO-Su5d-H8LO-a8t0-s8gH-WdWA-DXQZTr
[root@localhost-live ~]# lvscan
ACTIVE '/dev/vg_debussy/lv_root' [50.00 GiB] inherit
ACTIVE '/dev/vg_debussy/lv_swap' [<17.69 GiB] inherit
所以我删除了两个 lv_home - 一个是丢失的 PV,另一个是我想要保留的!
[root@localhost-live ~]# vgcfgrestore vg_debussy --test -f /etc/lvm/archive/vg_debussy_00000-611197733.vg
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
/dev/cdrom: open failed: No medium found
Couldn't find device with uuid F3lvXa-42cI-6Tx2-hmSr-3E0M-0PFE-W7kLj1.
Cannot restore Volume Group vg_debussy with 1 PVs marked as missing.
Restore failed.
那么,我现在能做什么呢?我正在通过实时 USB 运行它。