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.
This commit is contained in:
Jörg Thalheim authored and mergify[bot] committed 2024-09-24 16:53:30 +00:00
1 parent c61e50b63a
commit 6d42596a35
1 file changed
+9 -5
+9 -5
View File
@@ -130,11 +130,15 @@ in
(lv: [ (lv: [
(lib.optional (lv.content != null) lv.content._config) (lib.optional (lv.content != null) lv.content._config)
(lib.optional (lv.lvm_type != null) { (lib.optional (lv.lvm_type != null) {
boot.initrd.kernelModules = [ (if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid") ] boot.initrd.kernelModules = [
++ lib.optional (lv.lvm_type == "raid0") "raid0" # Prevent unbootable systems if LVM snapshots are present at boot time.
++ lib.optional (lv.lvm_type == "raid1") "raid1" "dm-snapshot"
# ++ lib.optional (lv.lvm_type == "raid10") "raid10" (if lv.lvm_type == "mirror" then "dm-mirror" else "dm-raid")
++ lib.optional ]
++ 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 == "raid4" ||
lv.lvm_type == "raid5" || lv.lvm_type == "raid5" ||
lv.lvm_type == "raid6") "raid456"; lv.lvm_type == "raid6") "raid456";