<div dir="ltr"><div>Hi Vojtech,</div><div><br></div><div>Thanks for looking it up.</div><div>It looks like the merging started in the background after all.</div><div><br></div><div>But here is the issue..</div><div><br></div><div>Merge initiates at 2022-01-04 17:40:31<br></div><div><span style="font-family:monospace">2022-01-04.17:40:31 MERGELV</span></div><div><br></div><div>And I do get a return code of that it starting in background, as the next command is executed, that tries to mount the filesystem<br></div><div><span style="font-family:monospace">2022-01-04.17:40:37 MOUNTFS</span></div><div><br></div><div>But, in the kernel log I can see these errors from mountfs, which I looping with a retry every 1s until it can get mounted<br></div><div><br></div><div><div><span style="font-family:monospace">Jan  4 17:40:38 debian10 kernel: [42138.075811] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:39 debian10 kernel: [42139.522164] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:41 debian10 kernel: [42140.877383] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:42 debian10 kernel: [42142.337237] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:43 debian10 kernel: [42143.757615] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:45 debian10 kernel: [42145.155576] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:46 debian10 kernel: [42146.277236] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:47 debian10 kernel: [42147.287412] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:48 debian10 kernel: [42148.317816] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:49 debian10 kernel: [42149.322470] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:50 debian10 kernel: [42150.332581] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:51 debian10 kernel: [42151.334976] XFS (dm-6): device supports 1024 byte sectors (not 512)<br>Jan  4 17:40:52 debian10 kernel: [42152.337999] XFS (dm-6): device supports 1024 byte sectors (not 512)</span></div><div><br></div><div>And the mountfs loop only ends when the merge has completed, hence the question of if it really works in the background?</div><div><br></div><div>The merge ends when the next command is about to be executed, where I am trying to reduce the disk from the volume group</div><div><br></div><div>2022-01-04.17:40:53  VGREDUCE<br></div><div><br></div><div>And there are no indication of any file system errors either</div><div><br></div><div>Jan  4 17:40:53 debian10 kernel: [42153.374758] XFS (dm-6): Mounting V5 Filesystem<br>Jan  4 17:40:53 debian10 kernel: [42153.378430] XFS (dm-6): Starting recovery (logdev: internal)<br>Jan  4 17:40:53 debian10 kernel: [42153.378741] XFS (dm-6): Ending recovery (logdev: internal)<br>Jan  4 17:41:53 debian10 kernel: [42213.622453] block nbd3: NBD_DISCONNECT<br></div><div><br></div></div><div>I have not analyzed into this more deeply, but could it be that LVM merge has a pre-phase  step, where it has to scan all the blocks first before actually starting a merge?</div><div>Because that can explain why, as our disks are emulated block device coming from the nmd devices</div><div><br></div><div>Or do you have any tips that can lead us into the right track?</div><div><br></div><div>Regards Tomas</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den tis 4 jan. 2022 kl 09:09 skrev Vojtech Trefny <<a href="mailto:vtrefny@redhat.com" target="_blank">vtrefny@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"><div dir="ltr"><div>Hi, libblockdev maintainer here, libblockdev is a separate project from LVM so it's better to ask on our GitHub[1], but I'm reading this ML too so I can answer here.<br><br></div>I did a quick test and the background merge works for me, so I think the problem is somewhere in LVM or with your setup, not in libblockdev -- all we do is run the "lvm lvconvert --merge <vg>/<snap> --background" command so there isn't a big room for a bug in our code (but I'm not saying there isn't one). I've modified your code a little bit[2], can you try running it again? I've just added logging so we can see what we actually tell LVM to run and also enabled LVM logging and saved the log to <span>/tmp/lvm.log.<br><br>[1] <a href="https://github.com/storaged-project/libblockdev" target="_blank">https://github.com/storaged-project/libblockdev</a><br>[2] <a href="https://gist.github.com/vojtechtrefny/7f379596958a0c4cd4c287c3f7a7dddd" target="_blank">https://gist.github.com/vojtechtrefny/7f379596958a0c4cd4c287c3f7a7dddd</a></span></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 3, 2022 at 9:06 AM Tomas Dalebjörk <<a href="mailto:tomas.dalebjork@gmail.com" target="_blank">tomas.dalebjork@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi,</div><div><br></div><div>I am trying to start a merge to the previous snapshot to be started with the "-b" flag (background). But it seems to be that the merging has not started in the background at all.</div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">        BDExtraArg      lv_arg = {"--background",""};<br>        const BDExtraArg        *extra_args[2] = {&lv_arg, NULL};<br><br>        BDPluginSpec lvm_plugin = {BD_PLUGIN_LVM, "libbd_lvm.so.2"};<br>        BDPluginSpec *plugins[] = {&lvm_plugin,NULL};<br><br>           bd_switch_init_checks (FALSE, &error);<br>               bd_ensure_init (plugins, NULL, &error);<br>        bd_lvm_lvsnapshotmerge(vg_name,lv_snap,extra_args,&error);</span><br>           </div><div><br></div><div>Couldn't find any details about how to do this using the libblockdev api, but according to the documentation, it should be possible to add the same flags as for the normal LVM commands.</div><div><br></div><div>Could you please give me a hint of what I am doing wrong?</div><div><br></div><div>Regards Tomas<br></div><div><br>  </div></div>
_______________________________________________<br>
linux-lvm mailing list<br>
<a href="mailto:linux-lvm@redhat.com" target="_blank">linux-lvm@redhat.com</a><br>
<a href="https://listman.redhat.com/mailman/listinfo/linux-lvm" rel="noreferrer" target="_blank">https://listman.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></blockquote></div>
_______________________________________________<br>
linux-lvm mailing list<br>
<a href="mailto:linux-lvm@redhat.com" target="_blank">linux-lvm@redhat.com</a><br>
<a href="https://listman.redhat.com/mailman/listinfo/linux-lvm" rel="noreferrer" target="_blank">https://listman.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></blockquote></div>