<div dir="ltr"><div>Thanks,</div><div><br></div><div>That really helped me to understand how the snapshot works.</div><div>Last question:</div><div>- lets say that block 100 which is 1MB in size is in the cow device, and a write happen that wants to something or all data on that region of block 100.</div><div>Than I assume; based on what have been previously said here, that the block in the cow device will be overwritten with the new changes.</div><div><br></div><div>Regards Tomas<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den tis 5 nov. 2019 kl 17:40 skrev Mikulas Patocka <<a href="mailto:mpatocka@redhat.com">mpatocka@redhat.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"><br>
<br>
On Mon, 4 Nov 2019, Tomas Dalebjörk wrote:<br>
<br>
> Thanks for feedback.<br>
> <br>
> Let me try to type different scenarios:<br>
> <br>
> We have an origin volume, lets call it: /dev/vg00/lv00<br>
> We convert a snapshot volume to origin volume, lets call it: /dev/vg00/lv00-snap<br>
> - all blocks has been changed, and are represented in the /dev/vg00/lv00-snap, when we start the lvconvert process<br>
> <br>
> I assume that something reads the data from /dev/vg00/lv00-snap and copy that to /dev/vg00/lv00<br>
> It will most likely start from the first block, to the last block to copy.<br>
<br>
Merging starts from the last block on the lv00-snap device and it proceeds <br>
backward to the beginning.<br>
<br>
> The block size is 1MB on /dev/vg00/lv00-snap, and we have for simplicity the same block size on the origin /dev/vg00/lv00<br>
> <br>
> Scenario 1: A read comes want to read block LP 100, but lvconvert has not yet copied that LP block.<br>
> Will the read comes from /dev/vg00/lv00-snap directly and delivered to requestor?<br>
<br>
Yes.<br>
<br>
> Or will lvconvert prioritize to copy data from /dev/vg00/lv00-snap to /dev/vg00/lv00 for that block, and let the requestor wait until the copying has been completed, so<br>
> that a read operation can happen from origin?<br>
> Or will the requestor have to wait until the copy data from /dev/vg00/lv00-snap to /dev/vg00/lv00 for that block has been completed, without any prioritization?<br>
<br>
It only waits if you attempt to read or write the block that is currently <br>
being copied.<br>
<br>
If you read data that hasn't been merged yet, it reads from the snapshot, <br>
if you read data that has been merged, it reads from the origin, if you <br>
read data that is currently being copied, it waits.<br>
<br>
> Scenario 2: A write comes want to write block LP 100, but lvconvert has not yet copied that LP block (yes, I do understand that origin is hidden now)<br>
> Will lvconvery prioritize to copy data from /dev/vg00/lv00-snap to /dev/vg00/lv00 for that block, and let the requestor write the changes directly on the origin after the<br>
> copying has been performed?<br>
<br>
No.<br>
<br>
> Or will the write be blocked until lvconvert has finished the copying of the requested block, and than a write can be accepted to the origin?<br>
> Or where will the changes be written?<br>
<br>
The changes will be written to the lv00-snap device.<br>
<br>
If you write data that hasn't been merged yet, the write is redirected to <br>
the lv00-snap device. If you write data that has already been merged, the <br>
write is directed to the origin device. If you write data that is <br>
currently being merged, it waits.<br>
<br>
> It is important for me to understand, as the backup device that I want to map as a COW device is a read only target, and is not allowed to be written to.<br>
<br>
You can't have read-only COW device. Both metadata and data on the COW <br>
device are updated during the merge.<br>
<br>
> If read happends from the backup COW device, and writes happends to the origin, than it is possible to create an instant recovery.<br>
> If writes happends to the backup COW device, than it not that easy to implement a instance reovery solution, as the backup device is write protected.<br>
> <br>
> Thanks in advance.<br>
<br>
Mikulas</blockquote></div>