ZFS: Difference between revisions

imported>2r
Updates
imported>2r
m formatting fixes
Line 55: Line 55:
</syntaxhighlight>
</syntaxhighlight>


== Take a snapshot automatically ==
 
== Auto ZFS trimming ==
 
<syntaxhighlight lang="nix" inline>services.zfs.trim.enable = true;</syntaxhighlight>.
 
For further information read the man pages.
 
== Take snapshots automatically ==


To auto-snapshot a ZFS filesystem or a ZVol, set its <code>com.sun:auto-snapshot</code> property to <code>true</code>, like this:
To auto-snapshot a ZFS filesystem or a ZVol, set its <code>com.sun:auto-snapshot</code> property to <code>true</code>, like this:
Line 164: Line 171:


When you login by SSH into the box or when you have physical access to the machine itself, you will be prompted to supply the unlocking password for your zroot and tankXXX pools.
When you login by SSH into the box or when you have physical access to the machine itself, you will be prompted to supply the unlocking password for your zroot and tankXXX pools.
== ZFS trimming ==
ZFS trimming works on one or more zpools and will trim each ssd inside it. There are two modes of it. One mode will manually trim the specified pool and the other will auto-trim pools. However the main difference is, that auto-trim will skip ranges that it considers too small while manually issued trim will trim all ranges.
To manually start trimming of a zpool run: <code>zpool trim tank</code>.
Since [https://github.com/NixOS/nixpkgs/pull/65331 PR-65331] this can be also done periodically (by default once a week) by setting <syntaxhighlight lang="nix" inline>services.zfs.trim.enable = true;</syntaxhighlight>.
To set a pool for auto-trim run: <code>zpool set autotrim=on tank</code>
To check the status of the manual trim, you can just run <code>zpool status -t</code>
To see the effects of trimming, you can run <code>zpool iostat -r</code> and <code>zpool iostat -w</code>
To see whether auto-trimming works, just run <code>zpool iostat -r</code> note the results and run it later again. The trim entries should change.
For further information read the [https://github.com/zfsonlinux/zfs/pull/8419 PR description].
[[Category:Guide]]
Following are a few discourse posts on zfs, serving as pointers, form your own opinion
* https://discourse.nixos.org/t/zfs-dedup-on-nix-store-is-it-worth-it/4959
* https://discourse.nixos.org/t/how-to-add-extra-build-input-to-linux-kernel/8208/3


== Mail notification for ZFS Event Daemon ==
== Mail notification for ZFS Event Daemon ==
Line 304: Line 286:
</syntaxhighlight>
</syntaxhighlight>
For more options, see <code>man 5 exports</code>.
For more options, see <code>man 5 exports</code>.
[[Category:Guide]]