1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Upstream db_persist udev rule from dracut

Setting db_persist is required for dm devices so that their properties
are carried over on switch-root from the initrd to the rootfs. This
logic has always lived in dracut
(https://github.com/dracutdevs/dracut/blob/master/modules.d/90dm/11-dm.rules).
However, this means that other initramfs generators each have to
implement and maintain the same rule which leads to unnecessary
duplication.

Instead, let's make the rule part of the upstream lvm rules, which
will ensure that generated initramfses will just work if they make
sure the lvm udev rules are installed, without having to figure out
that they have to add an extra rule themselves on top.

Identical rule in Arch Linux's lvm2 package: https://gitlab.archlinux.org/archlinux/packaging/packages/lvm2/-/blob/main/11-dm-initramfs.rules?ref_type=heads
This commit is contained in:
Daan De Meyer 2023-11-29 09:09:57 +01:00 committed by Peter Rajnoha
parent 48188d7181
commit eb4f744820

View File

@ -51,6 +51,11 @@ KERNEL!="dm-[0-9]*", GOTO="dm_end"
# is not recommended. # is not recommended.
ACTION=="remove", GOTO="dm_end" ACTION=="remove", GOTO="dm_end"
# Persist device state on transition from the initrd. This means all udev device
# properties are kept in the udev database even when it is cleaned up on
# switch-root.
OPTIONS+="db_persist"
# Decode udev control flags and set environment variables appropriately. # Decode udev control flags and set environment variables appropriately.
# These flags are encoded in DM_COOKIE variable that was introduced in # These flags are encoded in DM_COOKIE variable that was introduced in
# kernel version 2.6.31. Therefore, we can use this feature with # kernel version 2.6.31. Therefore, we can use this feature with