<div dir="ltr">Thanks for explaining all that details about how a snapshot is formatted on the COW device.<div>I already know that part.</div><div><br></div><div>I am more interested in how the disk containing the COW data can be merged back to an LV volume.</div><div>The second part only mentioned that it is possible, but not which steps are involved.</div><div><br></div><div>As documented in the manual.</div><div>To split a snapshot from its origin (our words detach) one can use:</div><div>lvconvert --splitsnapshot vg/s1</div><div>Right?</div><div><br></div><div>To reverse that process, according to the manual; one can use:</div><div>lvconvert -s vg/s1</div><div>Right?</div><div><br></div><div>But as I mentioned before, this requires that the vg/s1 exists as an object in the LVM metadata.</div><div>What if you are on a new server, that does not have vg/s1?</div><div>How to create that object or whatever you like to call this on the server?</div><div>The only way I got it is to use the </div><div>vgextend</div><div>lvcreate </div><div>lvconvert --splitsnapshot</div><div><br></div><div>And now reattach it, so that the actual merge can happen.</div><div>The object should exist now, so that the command: lvconvert -s vg/s1 can work</div><div><br></div><div>Or how can the object vg/s1 be created so that it can be referenced to by the lvconvert command?</div><div>The disk is formated as a COW device, and contains all of the data.</div><div>So how hard can it be to just reattach that volume to an empty or existing LV volume on the server?</div><div><br></div><div>If it works on same server, why can't it work on any other new servers, as the COW device contains ALL the data needed (we make sure it contains all the data)</div><div><br></div><div>If you want to give it a try, just create a snapshot on a specific device</div><div>And change all the blocks on the origin, there you are, you now have a cow device containing all data needed.</div><div>How to move this snapshot device to another server, reattach it to an empty lv volume as a snapshot.</div><div>lvconvert -s, command requires an argument of an existing snapshot volume name.</div><div>But there is no snapshot on the new server, so it can't re-attach the volume.</div><div>So what procedures should be invoked to create just the detached references in LVM, so that the lvconver -s command can work?</div><div><br></div><div>Regards Tomas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den tis 21 dec. 2021 kl 16:30 skrev Zdenek Kabelac <<a href="mailto:zdenek.kabelac@gmail.com">zdenek.kabelac@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dne 21. 12. 21 v 15:44 Tomas Dalebjörk napsal(a):<br>
> hi<br>
> <br>
> I think I didn’t explain this clear enough<br>
> Allthe lvm data is present in the snapshot that I provision from our backup system<br>
> I can guarantee that!<br>
> <br>
> If I just mount that snapshot from our backup system, it works perfectly well<br>
> <br>
> so we don’t need the origin volumes in other way than copying back to it<br>
> we just need to reanimate it as a cow volume<br>
> mentioning that all data has been changed<br>
> the cow is just referencing to the origin location, so no problem there<br>
> All our data is in the cow volume, not just the changes<br>
> <br>
> just to compare<br>
> if you change just 1 byte on every chunksize in the origin volume, than the snapshot will contain all data, plus some meta data etc.<br>
> That is what I talk about here.<br>
> So how do I retach this volume to a new server?<br>
> <br>
> as the only argument acceptable argument by the lvconvert is vg/s1 ?<br>
> <br>
> That assumes that vg/s1 is present<br>
> so how to make it present?<br>
<br>
Hi<br>
<br>
As said in my previous post - the 'format' of data stored on COW storage <br>
(which is the 'real' meaning of snapshot LV) does NOT in any way resembles the <br>
'normal' LV.<br>
<br>
So the COW LV could be really ONLY use together with 'snapshot' target.<br>
<br>
The easiest way how to 'copy' this snapshot to normal LV is like this:<br>
<br>
<br>
lvcreate -L size  -n newLV  vg<br>
<br>
dd if=/dev/vg/snapshotLV  of=/dev/vg/newLV  bs=512K<br>
<br>
<br>
(so with 'DD' you copy data in 'correct' format)<br>
<br>
You cannot convert snapshot LV to 'normal' LV in any other way then to merge <br>
this snapshot LV into your origin LV  (so origin is gone)<br>
(lvconvert --merge....)<br>
<br>
You can also  'split' snapshot COW LV and 'reattach' such snapshot to other LV <br>
- but this requires rather good knowledge about whole functioning of this <br>
snapshotting - so you know what can you do and what can you expect. But I'd <br>
likely recommend  'dd'.<br>
You cannot use 'splitted' COW LV for i.e. filesystem - as it contains 'mixed' <br>
snapshot metadata and snapshot blocks.<br>
<br>
Old snapshot meaning was - to take 'time consistent' snapshot of LV which then <br>
you can use for i.e. taking backup....<br>
<br>
Regards<br>
<br>
Zdenek<br>
</blockquote></div>