zfs: add migration path for new crypto format

fixes #34559
This commit is contained in:
sjau 2018-02-03 17:29:31 +01:00 committed by Jörg Thalheim
parent 4442a377cb
commit 0d65e2e0e5
4 changed files with 68 additions and 14 deletions

View File

@ -24,7 +24,11 @@ let
kernel = config.boot.kernelPackages;
packages = if config.boot.zfs.enableUnstable then {
packages = if config.boot.zfs.enableLegacyCrypto then {
spl = kernel.splLegacyCrypto;
zfs = kernel.zfsLegacyCrypto;
zfsUser = pkgs.zfsLegacyCrypto;
} else if config.boot.zfs.enableUnstable then {
spl = kernel.splUnstable;
zfs = kernel.zfsUnstable;
zfsUser = pkgs.zfsUnstable;
@ -75,6 +79,27 @@ in
'';
};
enableLegacyCrypto = mkOption {
type = types.bool;
default = false;
description = ''
Enabling this option will allow you to continue to use the old format for
encrypted datasets. With the inclusion of stability patches the format of
encrypted datasets has changed. They can still be access and mounted but
in read-only mode mounted. It is highly recommended to convert them to
the new format.
This option is only for convenience to people that cannot convert their
datasets to the new format yet and it will be removed in due time.
For migration strategies from old format to this new one, check the Wiki:
https://nixos.wiki/wiki/NixOS_on_ZFS#Encrypted_Dataset_Format_Change
See https://github.com/zfsonlinux/zfs/pull/6864 for more details about
the stability patches.
'';
};
extraPools = mkOption {
type = types.listOf types.str;
default = [];

View File

@ -66,8 +66,14 @@ in
};
splUnstable = common {
version = "2017-12-21";
rev = "c9821f1ccc647dfbd506f381b736c664d862d126";
sha256 = "08r6sa36jaj6n54ap18npm6w85v5yn3x8ljg792h37f49b8kir6c";
version = "2018-01-24";
rev = "23602fdb39e1254c669707ec9d2d0e6bcdbf1771";
sha256 = "09py2dwj77f6s2qcnkwdslg5nxb3hq2bq39zpxpm6msqyifhl69h";
};
splLegacyCrypto = common {
version = "2018-01-24";
rev = "23602fdb39e1254c669707ec9d2d0e6bcdbf1771";
sha256 = "09py2dwj77f6s2qcnkwdslg5nxb3hq2bq39zpxpm6msqyifhl69h";
};
}

View File

@ -5,7 +5,7 @@
, zlib, libuuid, python, attr, openssl
# Kernel dependencies
, kernel ? null, spl ? null, splUnstable ? null
, kernel ? null, spl ? null, splUnstable ? null, splLegacyCrypto ? null
}:
with stdenv.lib;
@ -19,6 +19,7 @@ let
, spl
, rev ? "zfs-${version}"
, isUnstable ? false
, isLegacyCrypto ? false
, incompatibleKernelVersion ? null } @ args:
if buildKernel &&
(incompatibleKernelVersion != null) &&
@ -43,7 +44,7 @@ let
buildInputs =
optionals buildKernel [ spl ]
++ optionals buildUser [ zlib libuuid python attr ]
++ optionals (buildUser && isUnstable) [ openssl ];
++ optionals (buildUser && (isUnstable || isLegacyCrypto)) [ openssl ];
# for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
NIX_CFLAGS_LINK = "-lgcc_s";
@ -160,19 +161,41 @@ in {
incompatibleKernelVersion = null;
# this package should point to a version / git revision compatible with the latest kernel release
version = "2018-01-10";
version = "2018-02-02";
rev = "1d53657bf561564162e2ad6449f80fa0140f1dd6";
sha256 = "0ibkhfz06cypgl2c869dzdbdx2i3m8ywwdmnzscv0cin5gm31vhx";
rev = "fbd42542686af053f0d162ec4630ffd4fff1cc30";
sha256 = "0qzkwnnk7kz1hwvcaqlpzi5yspfhhmd2alklc07k056ddzbx52qb";
isUnstable = true;
extraPatches = [
(fetchpatch {
url = "https://github.com/Mic92/zfs/compare/ded8f06a3cfee...nixos-zfs-2017-09-12.patch";
sha256 = "033wf4jn0h0kp0h47ai98rywnkv5jwvf3xwym30phnaf8xxdx8aj";
url = "https://github.com/Mic92/zfs/compare/fbd42542686af053f0d162ec4630ffd4fff1cc30...nixos-zfs-2018-02-02.patch";
sha256 = "05wqwjm9648x60vkwxbp8l6z1q73r2a5l2ni28i2f4pla8s3ahln";
})
];
spl = splUnstable;
};
zfsLegacyCrypto = common {
# comment/uncomment if breaking kernel versions are known
incompatibleKernelVersion = null;
# this package should point to a version / git revision compatible with the latest kernel release
version = "2018-02-01";
rev = "4c46b99d24a6e71b3c72462c11cb051d0930ad60";
sha256 = "011lcp2x44jgfzqqk2gjmyii1v7rxcprggv20prxa3c552drsx3c";
isUnstable = true;
extraPatches = [
(fetchpatch {
url = "https://github.com/Mic92/zfs/compare/4c46b99d24a6e71b3c72462c11cb051d0930ad60...nixos-zfs-2018-02-01.patch";
sha256 = "1gqmgqi39qhk5kbbvidh8f2xqq25vj58i9x0wjqvcx6a71qj49ch";
})
];
spl = splLegacyCrypto;
};
}

View File

@ -13120,7 +13120,7 @@ with pkgs;
sch_cake = callPackage ../os-specific/linux/sch_cake { };
inherit (callPackage ../os-specific/linux/spl {})
splStable splUnstable;
splStable splUnstable splLegacyCrypto;
spl = splStable;
@ -13151,7 +13151,7 @@ with pkgs;
inherit (callPackage ../os-specific/linux/zfs {
configFile = "kernel";
inherit kernel spl;
}) zfsStable zfsUnstable;
}) zfsStable zfsUnstable zfsLegacyCrypto;
zfs = zfsStable;
});
@ -13657,7 +13657,7 @@ with pkgs;
inherit (callPackage ../os-specific/linux/zfs {
configFile = "user";
}) zfsStable zfsUnstable;
}) zfsStable zfsUnstable zfsLegacyCrypto;
zfs = zfsStable;