Linux

無法刪除卷組

  • February 16, 2022

我在 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?

如果元數據區域像我的情況一樣為零,則不能使用--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

先跑vgreduce --removemissing $VG。這將刪除所有“部分”LV——即使用失去磁碟的任何 LV。男人:vgreduce(8)

引用自:https://serverfault.com/questions/894410