diff options
author | Svein Ove Aas <sveina@gmail.com> | 2015-12-23 00:29:47 +0100 |
---|---|---|
committer | Svein Ove Aas <sveina@gmail.com> | 2015-12-23 00:32:25 +0100 |
commit | 9a82dd87f7bfa6be85ecd70e118811accdd04a4d (patch) | |
tree | d8a178ce2bb6b6b9dfc99504d679ab9de00c2c64 /nixos | |
parent | cd7cfcc9a22fe61d7ff08befece3894225f8d064 (diff) | |
download | nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.tar nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.tar.gz nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.tar.bz2 nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.tar.lz nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.tar.xz nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.tar.zst nixlib-9a82dd87f7bfa6be85ecd70e118811accdd04a4d.zip |
zfs:Add zfs.devNodes option for zpool import -d
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/tasks/filesystems/zfs.nix | 19 |
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..14c6b05f95c7 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"; + 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) // { |