summary refs log tree commit diff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2016-01-05 14:37:19 -0800
committerWilliam A. Kennington III <william@wkennington.com>2016-01-05 14:37:19 -0800
commitce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0 (patch)
treeb3bc86550afe6980216c359b45571b01f88add8b /nixos/modules/tasks
parent60598311480a0f21599faed31c87fd7e75adbaaa (diff)
parent7688206a0bfaddf950a1fb85b84fabdc1232e7f8 (diff)
downloadnixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.tar
nixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.tar.gz
nixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.tar.bz2
nixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.tar.lz
nixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.tar.xz
nixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.tar.zst
nixlib-ce8c8f1e1b44f41831371bd07ebe8f2f2b9280a0.zip
Merge pull request #11890 from Baughn/zfs
zfs:Add option for zpool import -d, and set it to /dev/disk/by-id.
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix19
1 files changed, 17 insertions, 2 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index dedd3f5ca451..f4c42b162206 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -73,6 +73,21 @@ in
         '';
       };
 
+      devNodes = mkOption {
+        type = types.path;
+        default = "/dev/disk/by-id";
+        example = "/dev/disk/by-id";
+        description = ''
+          Name of directory from which to import ZFS devices.
+
+          Usually /dev works. However, ZFS import may fail if a device node is renamed.
+          It should therefore use stable device names, such as from /dev/disk/by-id.
+
+          The default remains /dev for 15.09, due to backwards compatibility concerns.
+          It will change to /dev/disk/by-id in the next NixOS release.
+        '';
+      };
+
       forceImportRoot = mkOption {
         type = types.bool;
         default = true;
@@ -214,7 +229,7 @@ in
             done
             ''] ++ (map (pool: ''
             echo "importing root ZFS pool \"${pool}\"..."
-            zpool import -d /dev/disk/by-id -N $ZFS_FORCE "${pool}"
+            zpool import -d ${cfgZfs.devNodes} -N $ZFS_FORCE "${pool}"
         '') rootPools));
       };
 
@@ -255,7 +270,7 @@ in
             };
             script = ''
               zpool_cmd="${zfsUserPkg}/sbin/zpool"
-              ("$zpool_cmd" list "${pool}" >/dev/null) || "$zpool_cmd" import -d /dev/disk/by-id -N ${optionalString cfgZfs.forceImportAll "-f"} "${pool}"
+              ("$zpool_cmd" list "${pool}" >/dev/null) || "$zpool_cmd" import -d ${cfgZfs.devNodes} -N ${optionalString cfgZfs.forceImportAll "-f"} "${pool}"
             '';
           };
       in listToAttrs (map createImportService dataPools) // {