ZFS: Difference between revisions
imported>Dotlambda m remove trailing whitespace |
imported>Cyounkins ZED needs ZFS to be be built with mail features, added test pool for email testing |
||
Line 516: | Line 516: | ||
ZFS Event Daemon (zed) monitors events generated by the ZFS kernel module and runs configured tasks. It can be configured to send an email when a pool scrub is finished or a disk has failed. | ZFS Event Daemon (zed) monitors events generated by the ZFS kernel module and runs configured tasks. It can be configured to send an email when a pool scrub is finished or a disk has failed. | ||
The <code>zfs</code> package must be built with mail features. The following override is needed as <code>zfs</code> is implicitly used in partition mounting: | |||
<syntaxhighlight lang="nix"> | |||
nixpkgs.config.packageOverrides = pkgs: { | |||
zfsStable = pkgs.zfsStable.override { enableMail = true; }; | |||
}; | |||
</syntaxhighlight> | |||
We need to configure a mail transfer agent, the program that sends email: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | { | ||
Line 565: | Line 573: | ||
ZED_SCRUB_AFTER_RESILVER = true; | ZED_SCRUB_AFTER_RESILVER = true; | ||
}; | }; | ||
# this | # this will error if zfs package override above is not used | ||
services.zfs.zed.enableMail = | services.zfs.zed.enableMail = true; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You can now test this by performing a scrub | You can now test this by performing a scrub on an existing pool, or on a small test pool: | ||
<syntaxhighlight lang="console"> | <syntaxhighlight lang="console"> | ||
$ cd /tmp | |||
$ dd if=/dev/zero of=sparse_file bs=1 count=0 seek=512M | |||
$ sudo zpool create test /tmp/sparse_file | |||
$ sudo zpool scrub test | |||
// Check for email | |||
$ sudo zpool export test | |||
$ rm sparse_file | |||
</syntaxhighlight> | </syntaxhighlight> | ||