From fd32e418f352d9793e8424f808c767e8e38204cf Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sat, 10 Oct 2026 22:07:44 +0000 Subject: [PATCH] Only import rpool via custom nodes, not all pools! --- modules/zfs.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/zfs.nix b/modules/zfs.nix index f88b435..dd2e218 100644 --- a/modules/zfs.nix +++ b/modules/zfs.nix @@ -147,13 +147,15 @@ in }; }; + # https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#selecting-dev-names-when-creating-a-pool-linux + # Default /dev/disk/by-id doesn't work on VM, but /dev/disk/by-uuid could. + boot.zfs.devNodes = "/dev/disk/by-path"; + # Restrict the "rpool" import path to rootDisks, if specified. This prevents # boot failures when a foreign disk containing ZFS pool "rpool" is inserted. services.udev.extraRules = lib.mkIf hasRootPaths rpoolRules; boot.initrd.services.udev.rules = lib.mkIf hasRootPaths rpoolRules; - # https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#selecting-dev-names-when-creating-a-pool-linux - # Default /dev/disk/by-id doesn't work on VM, but /dev/disk/by-uuid could. - boot.zfs.devNodes = lib.mkDefault (if hasRootPaths then "/dev/disk/rpool" else "/dev/disk/by-path"); + boot.zfs.pools.rpool.devNodes = lib.mkIf hasRootPaths "/dev/disk/rpool"; # We set forceImportRoot to true because our servers have exclusive access to # their local disks (no SANs/iSCSI). This guarantees they can recover and boot