2

I have a missed device in vgroup lvm. I want remove lvm group.

I did

# 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

Any idea to remove vg?

Pavel Gromov
  • 133
  • 1
  • 1
  • 9

2 Answers2

8

You cannot use --removemissing or force delete VG if metadata area equal zero as in my case.

Make block device from file and include in $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

After that I have Metadata Areas 1

vgremove --force $VG

and remove pvdevice:

pvremove /dev/loop0
Tombart
  • 2,013
  • 3
  • 27
  • 47
Pavel Gromov
  • 133
  • 1
  • 1
  • 9
3

Run vgreduce --removemissing $VG first. This will remove all "partial" LVs - that's any LVs using the missing disk. Man: vgreduce(8).

Martian
  • 1,060
  • 8
  • 8