From 6d42596a35d34918a905e8539a44d3fc91f42b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 24 Sep 2024 17:04:30 +0200 Subject: [PATCH] lvm: add missing dm-snapshot Usually this is added by nixos-generate-config. However now that we run nixos-generate-config before disko or we even run nixos-facter, we likely not see the LVM block devices anymore. --- lib/types/lvm_vg.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/types/lvm_vg.nix b/lib/types/lvm_vg.nix index 29360db..2a5cfe1 100644 --- a/lib/types/lvm_vg.nix +++ b/lib/types/lvm_vg.nix @@ -130,11 +130,15 @@ in (lv: [ (lib.optional (lv.content != null) lv.content._config) (lib.optional (lv.lvm_type != null) { - boot.initrd.kernelModules = [ (if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid") ] - ++ lib.optional (lv.lvm_type == "raid0") "raid0" - ++ lib.optional (lv.lvm_type == "raid1") "raid1" - # ++ lib.optional (lv.lvm_type == "raid10") "raid10" - ++ lib.optional + boot.initrd.kernelModules = [ + # Prevent unbootable systems if LVM snapshots are present at boot time. + "dm-snapshot" + (if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid") + ] + ++ lib.optional (lv.lvm_type == "raid0") "raid0" + ++ lib.optional (lv.lvm_type == "raid1") "raid1" + # ++ lib.optional (lv.lvm_type == "raid10") "raid10" + ++ lib.optional (lv.lvm_type == "raid4" || lv.lvm_type == "raid5" || lv.lvm_type == "raid6") "raid456";