guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#41143] Some clarification


From: Mikhail Tsykalov
Subject: [bug#41143] Some clarification
Date: Fri, 15 May 2020 01:53:26 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.8.0

Hi,

In LVM one volume group usually haves more than one logical volume, so target need to be a list. Just setting target to list in config doesn't work because that field is actually used for checking when (and whether at all) the device needs to be mounted. Because we still need to support using a string as target, we need to handle two situations: target is a string and target is list of strings. Patch converts plain string target to single element list and proceeds with assuming a list. grep by mapped-device-target revealed two uses in gnu/system.scm and one in gnu/services/base.scm. First two checked if any filesystems used a device, so I replaced plain string comparison with comparison with every element of list and returning true if any of them matched. Last one used target for building service name for shepherd, so I replaced plain target with concatenation of every target that mapped device has.

Moving on to second patch. Basically to mount LVM you need to activate volume group(s) with command "vgchange -ay". It worked fine with non-root mounts, but when it got moved in initrd it crashed. Quick look around found that while /dev/dm-X devices were being created, /dev/mapper/ nodes were not. Looking at man pages (and internet) "vgscan --mknodes" looked like what I wanted (there is also dmsetup mknodes, but basically first just calls it). After adding it, boot with root on LVM started working, so I left it. Also I check that targets actually exist, so you get crash in a bit more appropriate place. This check should probably be moved to somewhere else, but I haven't found better solution.

Looking at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/udev_device_manager 10-dm.rules looks like what creates /dev/mapper nodes in normal systems, so probably more proper solution will be to add udevd to initrd, but I don't know how to run daemons in initrd properly. dracut also creates file /etc/lvm/lvm.conf, which doesn't seem to be very important, but I probably should look closer to it. Also both dracut and LVM add "--ignorelockingfailure" flag to vgchange, which I forgot and will change in future patches.

There seems to be close to no resources about mounting LVM in initrd, so I'm adding code from other initrd generators:

Dracut: https://github.com/dracutdevs/dracut/blob/master/modules.d/90lvm/lvm_scan.sh

LVM: https://github.com/lvmteam/lvm2/blob/master/scripts/lvm2create_initrd/lvm2create_initrd






reply via email to

[Prev in Thread] Current Thread [Next in Thread]