unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Mikhail Tsykalov <tsymsh@gmail.com>
To: 41143@debbugs.gnu.org
Subject: [bug#41143] Some clarification
Date: Fri, 15 May 2020 01:53:26 +0300	[thread overview]
Message-ID: <7e96c284-c69c-965f-6bae-9546b1c711ad@gmail.com> (raw)
In-Reply-To: <CAMaATaPqFZTB-j9MyhS4+vrn8sjA25xzu2+DD71nE541yCiRwQ@mail.gmail.com>

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





  parent reply	other threads:[~2020-05-14 22:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  1:12 [bug#41143] [PATCH 1/2] mapped-devices: Allow target to be list of strings tsmish
2020-05-09  1:22 ` [bug#41143] [PATCH 2/2] mapped-devices: Add 'lvm-device-mapping' tsmish
2020-09-09 20:48   ` Ludovic Courtès
2020-05-14 22:53 ` Mikhail Tsykalov [this message]
2020-05-15  1:17 ` [bug#41143] [PATCH] mapped-devices: Document lvm-mapping-device Mikhail Tsykalov
2020-06-06 13:40 ` [bug#41143] [PATCH 1/2] mapped-devices: Allow target to be list of strings Lars-Dominik Braun
2020-06-06 20:16   ` Mikhail Tsykalov
2020-06-07  6:48     ` Lars-Dominik Braun
2020-09-09 20:38 ` Ludovic Courtès
2020-09-24 16:09   ` Mikhail Tsykalov
2020-09-25  9:34     ` Ludovic Courtès
2020-09-25 13:36       ` Mikhail Tsykalov
2020-09-25 16:20         ` Ludovic Courtès
2020-10-01 22:48           ` [bug#41143] [PATCH v2 " Mikhail Tsykalov
2020-10-01 22:49             ` [bug#41143] [PATCH v2 2/2] mapped-devices: Add 'lvm-device-mapping' Mikhail Tsykalov
2020-10-04 10:34               ` Ludovic Courtès
2020-10-04 10:28             ` [bug#41143] [PATCH v2 1/2] mapped-devices: Allow target to be list of strings Ludovic Courtès
2020-11-05  9:48               ` Ludovic Courtès
2020-11-06  9:47                 ` [bug#41143] [PATCH v3 " Mikhail Tsykalov
2020-11-06  9:47                   ` [bug#41143] [PATCH v3 2/2] mapped-devices: Add 'lvm-device-mapping' Mikhail Tsykalov
2020-11-25 23:09                   ` bug#41143: [PATCH v3 1/2] mapped-devices: Allow target to be list of strings Ludovic Courtès
2020-10-01 23:15           ` [bug#41143] [PATCH " Mikhail Tsykalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e96c284-c69c-965f-6bae-9546b1c711ad@gmail.com \
    --to=tsymsh@gmail.com \
    --cc=41143@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).