Bug#975873: Please hook zfs-share up to nfs-kernel-server stop+start

Trent W. Buck trentbuck at gmail.com
Sun Jan 10 07:25:56 GMT 2021


Michael Biebl wrote:
> I never used ZFS, so I basically have zero knowledge how it is supposed to work.

Here is a rough summary, I hope this helps!

ZFS glossary:

 * a "vdev" is an underlying physical disks/partitions (e.g. /dev/sda)
 * a "pool" is made of 1 or more vdevs (e.g. "morpheus")
 * a "dataset" is a logical volume/filesystem inside the pool (e.g. "morpheus/home/alice")
 * a "zvol" or "volume" is a dataset that stores blocks (used for e.g. VMs)
 * a "zfs" or "filesystem" is a dataset that stores files
 * a "property" is a key/value pair associated with a dataset (e.g. "compression=lz4").

NFS integration background:

 * ZFS properties can (optionally) replace /etc/fstab, /etc/exports, /etc/smb.conf.

 * If you do

      zfs set mountpoint=/home morpheus/home
      zfs set sharenfs=on      morpheus/home

   that is roughly like

      morpheus/home /home zfs defaults     # in fstab
      /home *(rw)                          # in exports

 * USUALLY that is all you need.
   ZFS calls mount/umount/exportfs/... automatically when appropriate,
   so the running system matches the ZFS properties.

 * You can call "zfs unshare" to manually stop NFS/SMB shares configured via ZFS properties.
 * You can call "zfs share" to manually start NFS/SMB shares configured via ZFS properties.

Postscript:

 * Properties are recursive, so if you have ZFS datasets like

       morpheus/home
       morpheus/home/alice
       morpheus/home/bob

   If you "zfs set sharenfs=on morpheus/home", alice & bob are implicitly also shared.

   For NFS, this means things Just Work without needing no_subtree_check or a lot of repetition in /etc/exports.


 * The sharenfs= property can be more complicated than "on".
   The notation follows Solaris, not Linux.

   For example,

       zfs set sharenfs=sec=sys,ro,rw=example.com,rw=example.net,all_squash morpheus/home

   means something like

       /home *(ro,sec=sys,all_squash)
       /home example.com(rw,sec=sys,all_squash)
       /home example.net(rw,sec=sys,all_squash)



More information about the Pkg-systemd-maintainers mailing list