-
Notifications
You must be signed in to change notification settings - Fork 1.8k
contrib/initramfs: use LVM autoactivation for activating VGs #17125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Currently, the zfs initramfs-tools boot script under local-top calls `vgchange -ay`, which unconditionally activates all logical volumes (LVs) in all discovered volume groups (VGs). This causes all LVs to be active after boot. However, users may prefer to not activate certain VGs/LVs on boot. They might normally use the `--setautoactivation n` VG/LV flag or the `auto_activation_volume_list` LVM config option to achieve this, but since the script unconditionally activates all LVs, neither has an effect. To fix this, call `vgchange -aay` instead. This triggers LVM autoactivation, which honors autoactivation settings such as the `--setautoactivation` flag. It is also more in line with the LVM documentation, which says autoactivation is "meant to be used by activation commands that are run automatically by the system" [1]. Note that this change might break misconfigured setups that have ZFS on top of an LV for which autoactivation is disabled. [1] https://gitlab.com/lvmteam/lvm2/-/blob/cff93e4d/conf/example.conf.in#L1579 Signed-off-by: Friedrich Weber <[email protected]> Reviewed-by: Fabian Grünbichler <[email protected]>
3726c50
to
693ab2e
Compare
I think what you have here makes sense. Just archiving this text in case someone gets bit by this change: If autoactivation option is used (-aay), each logical volume in the volume group is activated only if it matches an item in the activation/auto_activation_volume_list set in lvm.conf. |
I'd be happy to pull this in if we can get one more reviewer on it. |
Thanks for the review and merge! |
…#17125) Currently, the zfs initramfs-tools boot script under local-top calls `vgchange -ay`, which unconditionally activates all logical volumes (LVs) in all discovered volume groups (VGs). This causes all LVs to be active after boot. However, users may prefer to not activate certain VGs/LVs on boot. They might normally use the `--setautoactivation n` VG/LV flag or the `auto_activation_volume_list` LVM config option to achieve this, but since the script unconditionally activates all LVs, neither has an effect. To fix this, call `vgchange -aay` instead. This triggers LVM autoactivation, which honors autoactivation settings such as the `--setautoactivation` flag. It is also more in line with the LVM documentation, which says autoactivation is "meant to be used by activation commands that are run automatically by the system" [1]. Note that this change might break misconfigured setups that have ZFS on top of an LV for which autoactivation is disabled. [1] https://gitlab.com/lvmteam/lvm2/-/blob/cff93e4d/conf/example.conf.in#L1579 Reviewed-by: Fabian Grünbichler <[email protected]> Signed-off-by: Friedrich Weber <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
…#17125) Currently, the zfs initramfs-tools boot script under local-top calls `vgchange -ay`, which unconditionally activates all logical volumes (LVs) in all discovered volume groups (VGs). This causes all LVs to be active after boot. However, users may prefer to not activate certain VGs/LVs on boot. They might normally use the `--setautoactivation n` VG/LV flag or the `auto_activation_volume_list` LVM config option to achieve this, but since the script unconditionally activates all LVs, neither has an effect. To fix this, call `vgchange -aay` instead. This triggers LVM autoactivation, which honors autoactivation settings such as the `--setautoactivation` flag. It is also more in line with the LVM documentation, which says autoactivation is "meant to be used by activation commands that are run automatically by the system" [1]. Note that this change might break misconfigured setups that have ZFS on top of an LV for which autoactivation is disabled. [1] https://gitlab.com/lvmteam/lvm2/-/blob/cff93e4d/conf/example.conf.in#L1579 Reviewed-by: Fabian Grünbichler <[email protected]> Signed-off-by: Friedrich Weber <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
…#17125) Currently, the zfs initramfs-tools boot script under local-top calls `vgchange -ay`, which unconditionally activates all logical volumes (LVs) in all discovered volume groups (VGs). This causes all LVs to be active after boot. However, users may prefer to not activate certain VGs/LVs on boot. They might normally use the `--setautoactivation n` VG/LV flag or the `auto_activation_volume_list` LVM config option to achieve this, but since the script unconditionally activates all LVs, neither has an effect. To fix this, call `vgchange -aay` instead. This triggers LVM autoactivation, which honors autoactivation settings such as the `--setautoactivation` flag. It is also more in line with the LVM documentation, which says autoactivation is "meant to be used by activation commands that are run automatically by the system" [1]. Note that this change might break misconfigured setups that have ZFS on top of an LV for which autoactivation is disabled. [1] https://gitlab.com/lvmteam/lvm2/-/blob/cff93e4d/conf/example.conf.in#L1579 Reviewed-by: Fabian Grünbichler <[email protected]> Signed-off-by: Friedrich Weber <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
…#17125) Currently, the zfs initramfs-tools boot script under local-top calls `vgchange -ay`, which unconditionally activates all logical volumes (LVs) in all discovered volume groups (VGs). This causes all LVs to be active after boot. However, users may prefer to not activate certain VGs/LVs on boot. They might normally use the `--setautoactivation n` VG/LV flag or the `auto_activation_volume_list` LVM config option to achieve this, but since the script unconditionally activates all LVs, neither has an effect. To fix this, call `vgchange -aay` instead. This triggers LVM autoactivation, which honors autoactivation settings such as the `--setautoactivation` flag. It is also more in line with the LVM documentation, which says autoactivation is "meant to be used by activation commands that are run automatically by the system" [1]. Note that this change might break misconfigured setups that have ZFS on top of an LV for which autoactivation is disabled. [1] https://gitlab.com/lvmteam/lvm2/-/blob/cff93e4d/conf/example.conf.in#L1579 Reviewed-by: Fabian Grünbichler <[email protected]> Signed-off-by: Friedrich Weber <[email protected]> Reviewed-by: Tony Hutter <[email protected]>
Motivation and Context
Currently, when zfs-initramfs is installed on a host, all LVM LVs will be activated on boot, regardless of the respective VG/LV autoactivation settings such as
--setautoactivation n
on an LV. The reason is that a boot script shipped by zfs-initramfs callsvgchange -ay
, which unconditionally activates all LVs. This patch changes the call tovgchange -aay
, which honors autoactivation settings.For context: We encountered this on Proxmox VE (a Debian derivative shipping ZFS focused on virtualization), where it is not uncommon to e.g. boot from ZFS but have additional LVM VGs on external storage, e.g. on a LUN provided by a SAN and accessed via iSCSI/Fibre Channel. We were looking into disabling autoactivation in order to fix a bug, and wondered why
--setautoactivation n
did not appear to have an effect on VGs that are already visible at boot. If you're interested, you can find more details in this patch series.Description
See also the commit message.
One way to reproduce:
a
flag):apt install zfsutils-linux zfs-initramfs
How Has This Been Tested?
Ater running the reproducer above, I applied this patch manually to
/usr/share/initramfs-tools/scripts/local-top/zfs
, updated initramfs, rebooted, and verified that LVtestvg/testlv
is not active.Types of changes
Checking "breaking change" here, as it is technically one on setups which can be considered misconfigured, see the commit message.
Checklist:
I believe the unchecked boxes do not apply here though I'm not 100% sure -- if they do, please let me know. :)
Signed-off-by
.