Skip to content

Commit 3726c50

Browse files
committed
contrib/initramfs: use LVM autoactivation for activating VGs
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]>
1 parent 57f192f commit 3726c50

File tree

1 file changed

+2
-2
lines changed
  • contrib/initramfs/scripts/local-top

1 file changed

+2
-2
lines changed

contrib/initramfs/scripts/local-top/zfs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ activate_vg()
4141
return 1
4242
fi
4343

44-
# Detect and activate available volume groups
44+
# Detect and auto-activate available volume groups
4545
/sbin/lvm vgscan
46-
/sbin/lvm vgchange -a y --sysinit
46+
/sbin/lvm vgchange -aay --sysinit
4747
return $?
4848
}
4949

0 commit comments

Comments
 (0)