linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Creating/restoring snapshots in early userspace
@ 2022-08-07 20:38 cd
  2022-08-08 10:57 ` Zdenek Kabelac
  0 siblings, 1 reply; 4+ messages in thread
From: cd @ 2022-08-07 20:38 UTC (permalink / raw)
  To: linux-lvm

Hello,

I have created some scripts which runs in the initramfs during the boot process. Very specifically, it's an initcpio runtime hook https://man.archlinux.org/man/mkinitcpio.8#ABOUT_RUNTIME_HOOKS
Question: Is this a supported environment which to create/restore snapshots?

When my script runs lvm lvconvert --merge testvg/lvmautosnap-root-1659902622-good
it appears to succeed (exit code is 0, and the restore appears to work properly). However, the following warnings appear in stderr as part of the restore process:

/usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902622-good.
/usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902707-pending-2.
/usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to monitor testvg/lvmautosnap-root-1659902707-pending-2.
Merging of volume testvg/lvmautosnap-root-1659902622-good started.
/run/lvm/lvmpolld.socket: connect failed: No such file or directory
WARNING: Failed to connect to lvmpolld. Proceeding with polling without using lvmpolld.
WARNING: Check global/use_lvmpolld in lvm.conf or the lvmpolld daemon state.
testvg/root: Merged: 97.92%
testvg/root: Merged: 100.00%
Merge of snapshot into logical volume testvg/root has finished.
/usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902707-pending-2.
/usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to monitor testvg/lvmautosnap-root-1659902707-pending-2.
Logical volume "lvmautosnap-root-1659902622-good" successfully removed.

And I get similar errors when trying to create new volumes with lvm lvcreate --permission=r --snapshot --monitor n --name my_snapshot
 /usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902707-pending-2.
Logical volume "lvmautosnap-root-1659903385-pending" created.'
+ lvm_handle_error 0 '  /usr/bin/dmeventd: stat failed: No such file or directory
WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902707-pending-2.
Logical volume "lvmautosnap-root-1659903385-pending" created

I have noticed the --monitor n option exists for lvcreate, and that does seem to cut down on the error messages. However, trying to use the --driverloaded n flag always fails,
with a message like "Failed to find logical volume".

In summary, I'm happy to just ignore the warning messages. I just want to make sure I'm not risking the integrity of the lvm volumes by modifying them during this part of the boot process.

Kindly,
Anil Kulkarni

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] Creating/restoring snapshots in early userspace
  2022-08-07 20:38 [linux-lvm] Creating/restoring snapshots in early userspace cd
@ 2022-08-08 10:57 ` Zdenek Kabelac
  2022-08-08 18:14   ` cd
  0 siblings, 1 reply; 4+ messages in thread
From: Zdenek Kabelac @ 2022-08-08 10:57 UTC (permalink / raw)
  To: cd, LVM general discussion and development

Dne 07. 08. 22 v 22:38 cd napsal(a):
> Hello,
> 
> I have created some scripts which runs in the initramfs during the boot process. Very specifically, it's an initcpio runtime hook https://man.archlinux.org/man/mkinitcpio.8#ABOUT_RUNTIME_HOOKS
> Question: Is this a supported environment which to create/restore snapshots?
> 
> When my script runs lvm lvconvert --merge testvg/lvmautosnap-root-1659902622-good
> it appears to succeed (exit code is 0, and the restore appears to work properly). However, the following warnings appear in stderr as part of the restore process:
> 
> /usr/bin/dmeventd: stat failed: No such file or directory
> WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902622-good.
> /usr/bin/dmeventd: stat failed: No such file or directory

Hi

Your initramfs likely needs to contain  'modified' version of your system's 
lvm.conf where 'monitoring'  will be disabled  (set to 0) - as you do not want 
to start your monitoring while you are operating in your ramdisk.

Once you flip to your rootfs with your regular /etc/lvm/lvm.conf  - you need 
to start monitoring of you activated LVs  (vgchange --monitor y)

> Merging of volume testvg/lvmautosnap-root-1659902622-good started.
> /run/lvm/lvmpolld.socket: connect failed: No such file or directory

Again a thing you do not want to run in your ramdisk - lvmpolld is another 
service/daemon you should run while you are in your rootfs.

fully removed.
> 
> And I get similar errors when trying to create new volumes with lvm lvcreate --permission=r --snapshot --monitor n --name my_snapshot
>   /usr/bin/dmeventd: stat failed: No such file or directory
> 
> In summary, I'm happy to just ignore the warning messages. I just want to make sure I'm not risking the integrity of the lvm volumes by modifying them during this part of the boot process.

It looks like you are trying to do something in your ramdisk you really should 
be doing once you flip to your rootfs  -   ramdisk is purely meant to be used 
to  get things  'booting' and flip to rootfs  ASAP -  doing things in your 
ramdisk which is really not a 'working environment'  sounds like you are 
asking yourself  for some big troubles with resolving error paths  (i.e. using 
unmonitored devices like 'snapshot/mirror/raids/thin...' for longer period of 
time is simply 'bad design/plan' - switch to rootfs should happen quickly 
after you initiate things in your initramdfs...

Regards

Zdenek

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] Creating/restoring snapshots in early userspace
  2022-08-08 10:57 ` Zdenek Kabelac
@ 2022-08-08 18:14   ` cd
  2022-08-08 19:17     ` Zdenek Kabelac
  0 siblings, 1 reply; 4+ messages in thread
From: cd @ 2022-08-08 18:14 UTC (permalink / raw)
  To: Zdenek Kabelac; +Cc: LVM general discussion and development

>
>
> Dne 07. 08. 22 v 22:38 cd napsal(a):
>
> > Hello,
> >
> > I have created some scripts which runs in the initramfs during the boot process. Very specifically, it's an initcpio runtime hook https://man.archlinux.org/man/mkinitcpio.8#ABOUT_RUNTIME_HOOKS
> > Question: Is this a supported environment which to create/restore snapshots?
> >
> > When my script runs lvm lvconvert --merge testvg/lvmautosnap-root-1659902622-good
> > it appears to succeed (exit code is 0, and the restore appears to work properly). However, the following warnings appear in stderr as part of the restore process:
> >
> > /usr/bin/dmeventd: stat failed: No such file or directory
> > WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902622-good.
> > /usr/bin/dmeventd: stat failed: No such file or directory
>
>
> Hi
>
> Your initramfs likely needs to contain 'modified' version of your system's
> lvm.conf where 'monitoring' will be disabled (set to 0) - as you do not want
> to start your monitoring while you are operating in your ramdisk.
>
> Once you flip to your rootfs with your regular /etc/lvm/lvm.conf - you need
> to start monitoring of you activated LVs (vgchange --monitor y)
>
> > Merging of volume testvg/lvmautosnap-root-1659902622-good started.
> > /run/lvm/lvmpolld.socket: connect failed: No such file or directory
>
>
> Again a thing you do not want to run in your ramdisk - lvmpolld is another
> service/daemon you should run while you are in your rootfs.
>
> fully removed.
>
> > And I get similar errors when trying to create new volumes with lvm lvcreate --permission=r --snapshot --monitor n --name my_snapshot
> > /usr/bin/dmeventd: stat failed: No such file or directory
> >
> > In summary, I'm happy to just ignore the warning messages. I just want to make sure I'm not risking the integrity of the lvm volumes by modifying them during this part of the boot process.
>
>
> It looks like you are trying to do something in your ramdisk you really should
> be doing once you flip to your rootfs - ramdisk is purely meant to be used
> to get things 'booting' and flip to rootfs ASAP - doing things in your
> ramdisk which is really not a 'working environment' sounds like you are
> asking yourself for some big troubles with resolving error paths (i.e. using
> unmonitored devices like 'snapshot/mirror/raids/thin...' for longer period of
> time is simply 'bad design/plan' - switch to rootfs should happen quickly
> after you initiate things in your initramdfs...
>
> Regards
>
> Zdenek

Thanks for the insightful response. Indeed, setting monitoring = 0 in lvm.conf makes the warning messages go away. Interestingly, on arch, the initcpio hook for lvm2 _does_ attempt to set this setting:
with sed -i '/^\smonitoring =/s/1/0/' "${BUILDROOT}/etc/lvm/lvm.conf"
https://github.com/archlinux/svntogit-packages/blob/packages/lvm2/trunk/lvm2_install#L38

However, the sed pattern fails to match because the line is commented out in lvm.conf.
I've filed a bug with arch to address this: https://bugs.archlinux.org/task/75552?project=1&string=lvm2

Thanks again!
Anil

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-lvm] Creating/restoring snapshots in early userspace
  2022-08-08 18:14   ` cd
@ 2022-08-08 19:17     ` Zdenek Kabelac
  0 siblings, 0 replies; 4+ messages in thread
From: Zdenek Kabelac @ 2022-08-08 19:17 UTC (permalink / raw)
  To: cd; +Cc: LVM general discussion and development

Dne 08. 08. 22 v 20:14 cd napsal(a):
>>
>>
>> Dne 07. 08. 22 v 22:38 cd napsal(a):
>>
>>> Hello,
>>>
>>> I have created some scripts which runs in the initramfs during the boot process. Very specifically, it's an initcpio runtime hook https://man.archlinux.org/man/mkinitcpio.8#ABOUT_RUNTIME_HOOKS
>>> Question: Is this a supported environment which to create/restore snapshots?
>>>
>>> When my script runs lvm lvconvert --merge testvg/lvmautosnap-root-1659902622-good
>>> it appears to succeed (exit code is 0, and the restore appears to work properly). However, the following warnings appear in stderr as part of the restore process:
>>>
>>> /usr/bin/dmeventd: stat failed: No such file or directory
>>> WARNING: Failed to unmonitor testvg/lvmautosnap-root-1659902622-good.
>>> /usr/bin/dmeventd: stat failed: No such file or directory
>>
>>
>> Hi
>>
>> Your initramfs likely needs to contain 'modified' version of your system's
>> lvm.conf where 'monitoring' will be disabled (set to 0) - as you do not want
>> to start your monitoring while you are operating in your ramdisk.
>>
>> Once you flip to your rootfs with your regular /etc/lvm/lvm.conf - you need
>> to start monitoring of you activated LVs (vgchange --monitor y)
>>
>>> Merging of volume testvg/lvmautosnap-root-1659902622-good started.
>>> /run/lvm/lvmpolld.socket: connect failed: No such file or directory
>>
>>
>> Again a thing you do not want to run in your ramdisk - lvmpolld is another
>> service/daemon you should run while you are in your rootfs.
>>
>> fully removed.
>>
>>> And I get similar errors when trying to create new volumes with lvm lvcreate --permission=r --snapshot --monitor n --name my_snapshot
>>> /usr/bin/dmeventd: stat failed: No such file or directory
>>>
>>> In summary, I'm happy to just ignore the warning messages. I just want to make sure I'm not risking the integrity of the lvm volumes by modifying them during this part of the boot process.
>>
>>
>> It looks like you are trying to do something in your ramdisk you really should
>> be doing once you flip to your rootfs - ramdisk is purely meant to be used
>> to get things 'booting' and flip to rootfs ASAP - doing things in your
>> ramdisk which is really not a 'working environment' sounds like you are
>> asking yourself for some big troubles with resolving error paths (i.e. using
>> unmonitored devices like 'snapshot/mirror/raids/thin...' for longer period of
>> time is simply 'bad design/plan' - switch to rootfs should happen quickly
>> after you initiate things in your initramdfs...
>>
>> Regards
>>
>> Zdenek
> 
> Thanks for the insightful response. Indeed, setting monitoring = 0 in lvm.conf makes the warning messages go away. Interestingly, on arch, the initcpio hook for lvm2 _does_ attempt to set this setting:
> with sed -i '/^\smonitoring =/s/1/0/' "${BUILDROOT}/etc/lvm/lvm.conf"
> https://github.com/archlinux/svntogit-packages/blob/packages/lvm2/trunk/lvm2_install#L38
> 
> However, the sed pattern fails to match because the line is commented out in lvm.conf.
> I've filed a bug with arch to address this: https://bugs.archlinux.org/task/75552?project=1&string=lvm2
> 

Yep - I think there was a similar issue with Dracut.
It's the side-effect result of making most of default settings as 'commented' 
- then this scripts stopped to work in such case.

Regards

Zdenek

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-08 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 20:38 [linux-lvm] Creating/restoring snapshots in early userspace cd
2022-08-08 10:57 ` Zdenek Kabelac
2022-08-08 18:14   ` cd
2022-08-08 19:17     ` Zdenek Kabelac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).