Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

LVM

LVM Removing VG with missing disk

If you removed a disk from a server and forgot to cleanly remove the configuration you may experience something similar.

Below shows what happens with lvremove:

# lvremove --force --verbose /dev/vg02/u01
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
    There are 1 physical volumes missing.
    Archiving volume group "vg02" metadata (seqno 2).
    Releasing logical volume "u01"
  Aborting vg_write: No metadata areas to write to!

Some people seem to have success with vgreduce commands but I ended up making a fake device and extending the VG in order to cleanup the LV.

# lvs
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  opt  vg01 -wi-ao---- 995.00g                                                    
  u01  vg02 -wi-----p- 248.00g                                                    

# dd if=/dev/zero of=/tmp/tmp.raw bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.0763176 s, 1.4 GB/s

# losetup -f
/dev/loop0

# losetup /dev/loop0 /tmp/tmp.raw 

# vgextend vg02 /dev/loop0
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  Physical volume "/dev/loop0" successfully created.
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  Volume group "vg02" successfully extended

# vgremove vg02 --force
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  Logical volume "u01" successfully removed
  Volume group "vg02" successfully removed

# pvremove /dev/loop0
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  Labels on physical volume "/dev/loop0" successfully wiped.

# losetup -d /dev/loop0  
# rm /tmp/tmp.raw 

# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  opt  vg01 -wi-ao---- 995.00g                                                    
# vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  vg01   1   1   0 wz--n- 999.99g 4.99g
# pvs
  WARNING: Device for PV ore6TE-2ues-rc5q-mkCN-hEHE-C4Av-paaxEH not found or rejected by a filter.
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sdb   vg01 lvm2 a--  999.99g 4.99g

admin

Bio Info for Riaan