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

Bug#955709: initramfs-tools: All LVM members of a Btrfs raid1 rootfs are not activated prior to btrfs device scan.



On Sat, 04 Apr 2020 01:40:18 +0200 Samuel Progin <samuel.progin@gmail.com> wrote:
[...]
>    * What led up to the situation?
> 1. A single Btrfs rootfs on the top of lvm is converted to a raid 1 array by adding a device (logical volume in this case) and running a Btrfs balance convert start.
> 2. # update-initramfs -u
> 3. # reboot
> 4. the reboot fails as the btrfs rootfs cannot be mounted, complaining that a device is missing, and dropping to an initramfs shell. The second device is missing as it is not yet active in lvm.
> 
>    * What exactly did you do (or not do) that was effective (or
>      ineffective)?
> I created a script in /etc/initramfs-tools/scripts/local-top that activates all LV with "lvm vgchange -ay" and chrooted and rebuilded with update-initramfs -u
> 
>    * What was the outcome of this action?
> The logical volumes are activated, and the btrfs rootfs volume is mounted properly. The systems boots up.

I can see why this is going wrong, and I'm not sure quite how to fix
it.  We've historically tried to make the initramfs portable across
device changes, so that rather than recording device IDs we rely on the
kernel command line and /etc/fstab to tell us which devices are
needed[*].  But they only name one device for each filesystem.

I can think of several options:

1. initramfs-tools provides a way for btrfs (and similar filesystems)
   to tell it about any extra devices they need, and records those in
   the initramfs (by LVM path or UUID).  They are activated at boot in
   the same way as other devices.  Moving the / or /usr filesystem to a
   new LV or changing its UUID can require an initramfs rebuild.
   Hopefully this won't be too surprising.

2. initramfs-tools or lvm2 provides a way to name additional required
   devices or volume groups, on the kernel command line.  This could
   be done in addition to option 1, as a rescue mechanism.

3. lvm2 adds a configuration option to control which volume groups are
   activated at boot.  The default could be all volume groups, or the
   current behaviour.

I would welcome comments on these from other maintainers.

Ben.

[*] The hibernation/resume device is an exception to this, but
hibernation images won't work across a device change anyway.

-- 
Ben Hutchings
Larkinson's Law: All laws are basically false.


Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: