#798431 lvm2: OriginLV lost if CacheLV failed

Package:
lvm2
Source:
lvm2
Description:
Linux Logical Volume Manager
Submitter:
Benoit Friry
Date:
2015-12-20 20:33:12 UTC
Severity:
normal
#798431#5
Date:
2015-09-09 09:49:01 UTC
From:
To:
Dear Maintainer,

Context and issue
-----------------
I want to use lvmcache to speedup access to data on RAID1.

Configuration is essentially:
 - 2 HDD in software raid1 with md -> one pv -> one VG
 - 1 SSD (/dev/sda1) is put in same VG
 - 1 of the LV is for /
 - I created a lvm cache for /

It happenned /dev/sda1 failed.  Boot failed.  I booted from Debian Live
CD, but I did not manage to repair.  lvtools and cache_check refused to
repair cmeta LV, and I did not find how to access it to try any manual
repairing.

I had to reinstall/restore.

Reproduction
------------
sda1 is the only partition on SSD
sde1 is the only partition on a USB key

*** LV creation
# vgcreate vgtest /dev/sda1 /dev/sde1
# lvcreate -n test -L 10G vgtest /dev/sda1
# lvcreate -n testcache -L 1G vgtest /dev/sde1
# lvcreate -n testcachemeta -L 8M vgtest /dev/sde1
# lvconvert --type cache-pool --poolmetadata vgtest/testcachemeta\
	--cachemode writethrough vgtest/testcache
# lvconvert --type cache --cachepool vgtest/testcache vgtest/test

*** LV failure
# lvs -a
# lvchange -an vgtest/test
# pvremove /dev/sde1 --force --force

*** LV recovery tentatives
# lvchange -ay vgtest/test
  WARNING: Device for PV NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I not found or rejected by a filter.
  Refusing activation of partial LV vgtest/test.  Use '--activationmode partial' to override.
# lvchange -ay vgtest/test --activationmode partial
  PARTIAL MODE. Incomplete logical volumes will be processed.
  WARNING: Device for PV NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I not found or rejected by a filter.
  Check of pool vgtest/testcache failed (status:1). Manual repair required!
# lvchange -ay vgtest/test_corig --force --activationmode partial
  PARTIAL MODE. Incomplete logical volumes will be processed.
  WARNING: Device for PV NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I not found or rejected by a filter.
  Unable to change internal LV test_corig directly
# lvconvert -v --force --uncache vgtest/test
  WARNING: Device for PV NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I not found or rejected by a filter.
    There are 1 physical volumes missing.
  Cannot change VG vgtest while PVs are missing.
  Consider vgreduce --removemissing.
    There are 1 physical volumes missing.
# vgreduce -v --force --removemissing vgtest
   Finding volume group "vgtest"
  WARNING: Device for PV NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I not found or rejected by a filter.
    There are 1 physical volumes missing.
    There are 1 physical volumes missing.
    Trying to open VG vgtest for recovery...
    Found same device /dev/sda1 with same pvid SFN1I61m6AOWxnMG5YjWvjVpPuQpNLAc
  WARNING: Device for PV NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I not found or rejected by a filter.
    There are 1 physical volumes missing.
    There are 1 physical volumes missing.
    Archiving volume group "vgtest" metadata (seqno 7).
  Removing partial LV test.
    Releasing logical volume "testcache"
    There are 1 physical volumes missing.
    Creating volume group backup "/etc/lvm/backup/vgtest" (seqno 8).
  Logical volume "testcache" successfully removed
    Releasing logical volume "test"
    There are 1 physical volumes missing.
    Creating volume group backup "/etc/lvm/backup/vgtest" (seqno 9).
  Logical volume "test" successfully removed
    Removing PV with UUID NubIyb-joYP-9Jei-Fhy3-xUuz-5SVf-3NSI0I from VG vgtest
    Creating volume group backup "/etc/lvm/backup/vgtest" (seqno 10).
  Wrote out consistent volume group vgtest

All LV is gone!

Using a cachethrough mode, OriginLV (/dev/sda1) was intact.
There must be some way to access it!


I did not find much clues on Internet.
Best hit: https://www.redhat.com/archives/linux-lvm/2015-August/msg00008.html


Best regards,
Benoit

#798431#10
Date:
2015-12-20 20:28:08 UTC
From:
To:
Hi,

#798431 was filed against version 2.02.127-1, but looking at the upstream
changelog at

https://git.fedorahosted.org/cgit/lvm2.git/tree/WHATS_NEW

I see lots of cache related changes in newer releases. Maybe someone can
try to repeat this bug with the 2.02.133-2 package in stretch/sid or if the
package could be updated to the latest 2.02.138 upstream release (just
released on Dec 14) then you could test with that.