我在 vgroup lvm 中丢失了一个设备。我想删除 lvm 组。
我做到了
# vgremove lvm --force
WARNING: Device for PV 6bVVia-tsco-GEyq-1zHZ-Vn8W-Eg0v-MNZMmG not found or rejected by a filter.
Aborting vg_write: No metadata areas to write to!
# vgdisplay
WARNING: Device for PV 6bVVia-tsco-GEyq-1zHZ-Vn8W-Eg0v-MNZMmG not found or rejected by a filter.
--- Volume group ---
VG Name lvm
System ID
Format lvm2
Metadata Areas 0
Metadata Sequence No 4966
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 32
Open LV 0
Max PV 0
Cur PV 1
Act PV 0
VG Size <3,00 TiB
PE Size 32,00 MiB
Total PE 98303
Alloc PE / Size 47232 / 1,44 TiB
Free PE / Size 51071 / <1,56 TiB
VG UUID X45X4f-3Po2-XRHb-sbiH-2cn0-pP6m-SZ8LhP
--- Volume group ---
VG Name lvm1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3167
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 23
Open LV 14
Max PV 0
Cur PV 1
Act PV 1
VG Size <2,00 TiB
PE Size 32,00 MiB
Total PE 65535
Alloc PE / Size 19264 / 602,00 GiB
Free PE / Size 46271 / 1,41 TiB
VG UUID OswxV5-YEMj-wiM7-fwAW-A61O-MpfQ-nXb3Vr
# pvs WARNING: Device for PV 6bVVia-tsco-GEyq-1zHZ-Vn8W-Eg0v-MNZMmG not found or rejected by a filter. WARNING: Device for PV 6bVVia-tsco-GEyq-1zHZ-Vn8W-Eg0v-MNZMmG not found or rejected by a filter. PV VG Fmt Attr PSize PFree /dev/zd16 lvm1 lvm2 a-- <2,00t 1,41t [unknown] lvm lvm2 u-m <3,00t <1,56t
有什么想法可以删除 vg 吗?
答案1
--removemissing
如果元数据区域等于零(就像我的情况一样),则不能使用或强制删除 VG。
从文件创建块设备并包含在$VG
:
dd if=/dev/zero of=/tmp/tmp.raw bs=1M count=100
losetup -f
losetup /dev/loop0 /tmp/tmp.raw
vgextend $VG /dev/loop0
之后我Metadata Areas 1
vgremove --force $VG
并删除 pvdevice:
pvremove /dev/loop0
答案2
首先运行vgreduce --removemissing $VG
。这将删除所有“部分”LV - 即使用丢失磁盘的任何 LV。Man:vgreduce(8)。