Blog/NFS on Btrfs
2021-04-25: Using NFS on Btrfs[edit | edit source]
Just a quick note on using NFS on Btrfs.
It works really well and reliably. We use it in production with XCP-ng (XenServer) as shared storage to host the disk images for VMs.
If you intend to use btrfs snapshots and roll back them, it can be wise to use the fsid export flag and use a unique number for each share. This is especially important for NFS clients that use the hard mount option. When you roll back a snapshot, the ID of the export could change which would confuse the client.
The Man page explains it well:
NFS needs to be able to identify each filesystem that it exports. Normally it will use a UUID for the filesystem (if the filesystem has such a thing) or the device number of the device holding the filesystem (if the filesystem is stored on the device).
As not all filesystems are stored on devices, and not all filesystems have UUIDs, it is sometimes necessary to explicitly tell NFS how to identify a filesystem. This is done with the fsid= option.
So just add it to your exports
/media/nfs/docs/ 192.168.0.1/24(fsid=111111,rw,sync,no_subtree_check) /media/nfs/music/ 192.168.0.1/24(fsid=222222,rw,sync,no_subtree_check)