<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p><br>
</p>
<p>This is the steps that I did.</p>
<p>- the COW data exists on /dev/loop1, including space for the PV
header + metadata</p>
<p>I created a fakevg template file from vgcfgbackup /tmp/fakevg.bkp
<br>
</p>
<p>( the content of this file I created fake uuid etc... )</p>
<p><br>
</p>
<p>I craete a fake uuid for the PV<br>
</p>
<p><font face="Courier New, Courier, monospace"># pvcreate -ff -u
fake-uidx-nrxx-xxxx --restorefile /tmp/fakevg.bkp</font><br>
</p>
<p><br>
</p>
<p>And created rhe metadata from the backup</p>
<p><font face="Courier New, Courier, monospace"># vgcfgrestore -f
/tmp/fakevg.bkp fakevg</font></p>
<p><br>
</p>
<p>I can now see the lvsnap in fakevg</p>
<p>Perhaps the restore can be done directly to the destination vg?
not sure...</p>
<p>Anyhow, I than used the vgsplit to move the fakevg data to the
destination vg</p>
<p><font face="Courier New, Courier, monospace"># vgsplit fakevg
destvg /dev/loop1</font></p>
<p><br>
</p>
<p>I know have the lvsnap volume in the correct volume group</p>
<p>From here, I connected the lvsnap to a lv destination using</p>
<p><font face="Courier New, Courier, monospace"># lvconvert -Zn -s
destvg/lvsnap destvg/destlv</font></p>
<p><br>
</p>
<p>I know have a snapshot connected to the origin destlv</p>
<p>From here, I can either mount the snapshot and start using it, or
revert to the snapshot</p>
<font face="Courier New, Courier, monospace"># lvchange -a n
destvg/destlv<br>
# lvconvert --merge -b destvg/lvsnap<br>
# lvchange -a y destvg/destlv</font>
<p><br>
</p>
<p>Now to my questions...</p>
<p>is there any DBUS api that can perform the vgcfgrestore
operations that I can use through C? <br>
</p>
<p>or another ways to recreate the metadata?</p>
<p>I have to now use two steps: pvcreate + vgcfgrestore, where I
just need to actually restore just the metadata (only
vgcfgrestore)?</p>
<p>If I run vgcfgrestore without pvcreate, than vgcfgrestore will
not find the pvid, and cant be executed with a parameter like:</p>
<p># vgcfgrestore -f vgXX.bkp /dev/nbd</p>
<p>Instead it has to be used with the parameter vgXX pointing out
the volume group...</p>
<p><br>
</p>
<p>I can live with vgcfgrestore + pvcreate, but would prefer to use
the libblockdev (DBUS) or another api from C directly.</p>
<p>What options do I have?</p>
<p><br>
</p>
<p>Thanks for an excellent help <br>
</p>
<p>God Bless</p>
<p>Tomas<br>
</p>
<p><br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Den 2020-09-07 kl. 19:50, skrev Zdenek
Kabelac:<br>
</div>
<blockquote type="cite"
cite="mid:643c43ad-0814-18a7-bb60-439adb4c6514@redhat.com">Dne 07.
09. 20 v 19:37 Tomas Dalebjörk napsal(a):
<br>
<blockquote type="cite">thanks
<br>
<br>
ok
<br>
vgsplit/merge instead
<br>
and after that lvconvert-s
<br>
<br>
yes, I am aware of the issues with corruption
<br>
but if the cow device has all data, than no corruption will
happen, right?
<br>
<br>
if COW has a copy of all blocks
<br>
than a lvconvert —merge, or mount of the snapshot volume will be
without issues
<br>
</blockquote>
<br>
If the 'COW' has all the data - why do you need then snapshot ?
<br>
Why not travel whole LV instead of snapshot ?
<br>
<br>
Also - nowdays this old (so called 'thick') snapshot is really
slow compared with thin-provisioning - might be good if you check
what kind of features
<br>
you can gain/loose if you would have switched to thin-pool
<br>
(clearly whole thin-pool (both data & metadata) would need to
travel between your VGs.)
<br>
<br>
Regards
<br>
<br>
Zdenek
<br>
<br>
</blockquote>
</body>
</html>