Saturday, March 2, 2013

ZFS + NFS: sharing files for XBMC

The NFS - XBMC page says that NFS has a lower protocol overhead than SMB, so let's try it and see if file sharing performance improves.
# 1. Install required package
jordi@topper:~$ sudo aptitude install nfs-kernel-server

# 2. Modify zfs configuration
jordi@topper:~$ sudo nano /etc/default/zfs:
  [...]
  # Run `zfs share -a` during system start?
  # nb: The shareiscsi, sharenfs, and sharesmb dataset properties.
  ZFS_SHARE='yes'
  
  # Run `zfs unshare -a` during system stop?
  ZFS_UNSHARE='yes'
  [...]

# 3. Set nfs configuration for our pools
jordi@topper:~$ sudo zfs set sharenfs='rw=@10.0.0.0/24,no_subtree_check,all_squash,insecure,anonuid=1000,anongid=100' tank
jordi@topper:~$ sudo zfs set sharenfs='rw=@10.0.0.0/24,no_subtree_check,all_squash,insecure,anonuid=1000,anongid=100' pool

# 4. Share everything
jordi@topper:~$ sudo zfs share -a

# Unshare everything (when needed)
jordi@topper:~$ sudo zfs unshare -a