ZFS: Difference between revisions

imported>2r
m fix typo
imported>2r
nfs sharing support
Line 591: Line 591:
}
}
</pre>
</pre>
==NFS share==
With <code>sharenfs</code> property, ZFS has build-in support for generating <code>/etc/exports.d/zfs.exports</code> file, which in turn is processed by NFS service automatically.
To enable NFS share on a dataset, only two steps are needed:
First, enable [[NFS service|NFS]]:
<syntaxhighlight lang="nix">
  services.nfs.server.enable = true;
</syntaxhighlight>
Only this line is needed. Configure firewall if necessary, as described in [[NFS]] article.
Then, set <code>sharenfs</code> property:
<pre>
zfs set sharenfs="ro=192.168.1.0/24,all_squash,anonuid=70,anongid=70" rpool/myData
</pre>
For more options, see <code>man 5 exports</code>.