<div dir="ltr">Thank you very much! That worked a treat.<div><br></div><div>Slightly scary process, but fortune favours the bold and backed-up ;) In all fairness cache device redundancy is mentioned in lvmcache(7), and I consider this to have been a worthy experiment.</div><div><br></div><div>Thanks again,</div><div>Dan<br><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 22, 2016 at 4:09 PM, Marian Csontos <span dir="ltr"><<a href="mailto:mcsontos@redhat.com" target="_blank">mcsontos@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 01/20/2016 12:23 AM, Daniel Leong wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I'm struggling to find information about lvmcache recovery after the cache<br>
fails. Is it possible to access an LVcache origin if the PV for the cache<br>
has failed?<br>
<br>
If I try partial mode :<br>
   lvchange -a y -P fedora/home<br>
<br>
Then it just hangs.<br>
<br>
If I try the home_corig directly :<br>
   lvchange -a y -P fedora/home_corig<br>
<br>
   "Unable to change internal LV home_corig directly"<br>
<br>
I can see the LVs with :<br>
    lvs -a -o +devices fedora<br>
<br>
The home_corig is still on /dev/sdb3 so I can probably find the blocks if<br>
needed ... but that seems like hard work!<br>
<br>
At the moment [cache_cdata] and [cache_cmeta] are on "unknown device"<br>
because it failed. Can I just extend to a new PV for the cache?<br>
</blockquote>
<br></span>
Hi, this is a known limitation. There is a Bug 1131777 - "LVM cache: If writethrough, allow abandoning cachepool if it has failed".<br>
<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1131777" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1131777</a><br>
<br>
In any case if you were using cache in writeback mode be ready for havoc in the filesystem as it is likely many "hot" filesystem metadata blocks were kept in cache and not written to HDD.<br>
<br>
THIS IS A DANGEROUS OPERATION!<br>
Any readers here, check the BZ above first if LVM already has a better solution.<br>
<br>
Proceed with extreme care! And better double check steps on #lvm IRC channel on freenode.<br>
<br>
First rule is:<br>
*Backup first.*<br>
<br>
Second rule is:<br>
Do not try to use --force/-f with lvm commands - many of them cause irrevocable damage.<br>
You want to check the man pages, and better ask before using the force.<br>
<br>
Now the steps:<br>
<br>
At the moment the only way is to edit metadata manually by using vgcfgbackup (or file from /etc/lvm/backup/) and vgcfgrestore.<br>
<br>
Ideally you will work on a copy of the disk. (You do have the backup, right?)<br>
<br>
If you have a system to test the steps "dry" run it there!<br>
Simulate device failure using:<br>
<br>
  echo 1 > /sys/block/DEV/device/delete<br>
<br>
Run the below steps on the test system and check the results.<br>
If in doubt ask. If everything went well, and you still have the backup, then you are safe to proceed.<br>
<br>
Run<br>
<br>
    vgcfgbackup -f FILE VG<br>
<br>
If the LV is active, I had to deactivate LVs before proceeding. I used<br>
<br>
    vgchange -an VG<br>
<br>
This hangs as it is trying to check the cache-pool. ^C will stop the check.<br>
<br>
Then I had to run:<br>
<br>
    vgreduce --removemissing VG<br>
<br>
Now editing the file FILE:<br>
<br>
1. Replace segments in home by those from home_corig. If necessary adjust segment_count.<br>
<br>
2. Remove home_corig, CACHE_cdata, CACHE_cmeta and CACHE.<br>
<br>
2.1 You may want to remove lvol0_pmspare if there are no thin-pools and no more cache pools in the system.<br>
<br>
3. Remove the missing PV - the one where device is unknown device:<br>
<br>
                        device = "unknown device"       # Hint only<br>
<br>
                        status = ["ALLOCATABLE"]<br>
                        flags = ["MISSING"]<br>
<br>
Then run:<br>
<br>
    vgcfgrestore -f FILE VG<br>
<br>
After the backup try proceeding with fsck.<br>
<br>
If anything went wrong, return to backup.<br>
<br>
-- Martian<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
Thanks for any tips, and apologies if I'm being stupid.<br>
<br>
Dan<br>
<br>
<br>
<br></span>
_______________________________________________<br>
linux-lvm mailing list<br>
<a href="mailto:linux-lvm@redhat.com" target="_blank">linux-lvm@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/linux-lvm" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/linux-lvm</a><br>
read the LVM HOW-TO at <a href="http://tldp.org/HOWTO/LVM-HOWTO/" rel="noreferrer" target="_blank">http://tldp.org/HOWTO/LVM-HOWTO/</a><br>
<br>
</blockquote>
<br>
</blockquote></div><br></div>