Skip to content

Commit

Permalink
nixos/zfs: introduce option to control hibernation
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanasdev000 committed Oct 29, 2022
1 parent 956e35d commit a538580
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,18 @@
<literal>hardware.saleae-logic.package</literal>.
</para>
</listitem>
<listitem>
<para>
ZFS module will not allow hibernation by default, this is a
safety measure to prevent data loss cases like the ones
described at
<link xlink:href="https://github.com/openzfs/zfs/issues/260">OpenZFS/260</link>
and
<link xlink:href="https://github.com/openzfs/zfs/issues/12842">OpenZFS/12842</link>.
Use the <literal>boot.zfs.allowHibernation</literal> option to
configure this behaviour.
</para>
</listitem>
<listitem>
<para>
The Redis module now disables RDB persistence when
Expand Down
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2211.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ Available as [services.patroni](options.html#opt-services.patroni.enable).

- A new module was added for the Saleae Logic device family, providing the options `hardware.saleae-logic.enable` and `hardware.saleae-logic.package`.

- ZFS module will not allow hibernation by default, this is a safety measure to prevent data loss cases like the ones described at [OpenZFS/260](https://github.com/openzfs/zfs/issues/260) and [OpenZFS/12842](https://github.com/openzfs/zfs/issues/12842). Use the `boot.zfs.allowHibernation` option to configure this behaviour.

- The Redis module now disables RDB persistence when `services.redis.servers.<name>.save = []` instead of using the Redis default.

- Neo4j was updated from version 3 to version 4. See this [migration guide](https://neo4j.com/docs/upgrade-migration-guide/current/) on how to migrate your Neo4j instance.
Expand Down
13 changes: 13 additions & 0 deletions nixos/modules/tasks/filesystems/zfs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@ in
'';
};

allowHibernation = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Allow hibernation support, this may be a unsafe option depending on your
setup. Make sure to NOT use Swap on ZFS.
'';
};

extraPools = mkOption {
type = types.listOf types.str;
default = [];
Expand Down Expand Up @@ -498,6 +507,10 @@ in

boot = {
kernelModules = [ "zfs" ];
# https://github.com/openzfs/zfs/issues/260
# https://github.com/openzfs/zfs/issues/12842
# https://github.com/NixOS/nixpkgs/issues/106093
kernelParams = lib.optionals (!config.boot.zfs.allowHibernation) [ "nohibernate" ];

extraModulePackages = [
(if config.boot.zfs.enableUnstable then
Expand Down

0 comments on commit a538580

Please sign in to comment.