Exporting ObjectiveFS to Windows via NFS

This guide covers the steps to share your ObjectiveFS filesystem from Linux to Windows via NFS. For Samba instructions, see this guide.

What You Need

On the Linux Server

  1. Mount your objectivefs filesystem (e.g. on /ofs).
$ sudo mount.objectivefs <your filesystem> /ofs
  1. Install NFS server.
Ubuntu
$ sudo apt-get install nfs-kernel-server
Red Hat/CentOS
$ sudo yum install nfs-utils
  1. In /etc/exports, add the following line where ip address is the windows machine’s ip address.
/ofs  <ip addr>(rw,fsid=<unique id>,no_subtree_check,mp,async)

Example to connect to a windows NFS client at 10.0.0.100:

/ofs  10.0.0.100(rw,fsid=222,no_subtree_check,mp,async)
  1. Increase the number of threads on the NFS server.
Ubuntu: In `/etc/default/nfs-kernel-server`
RPCNFSDCOUNT=<number of threads>  # e.g. 64
Red Hat/CentOS: In `/etc/sysconfig/nfs`
RPCNFSDCOUNT=<number of threads>  # e.g. 64
  1. Restart the service.
Ubuntu
$ sudo service nfs-kernel-server restart
$ sudo service idmapd restart   # you may also need to restart idmap
Red Hat/CentOS
$ sudo /etc/init.d/nfs restart
  1. Verify that the Linux server’s NFS port is open for connection from the Windows server.

On the Windows server

These steps are for Windows Server 2012 R2.

  1. Setup client for NFS.
Start
→ Server Manager
→ Manage (top right menu)
→ Add Roles
→ Select "Role-based or feature-based installation"
→ Select the current server
→ In "Server Roles", click next
→ In "Features", select "client for NFS" and click next
→ Click "Install" to confirm the installation
  1. A registry addition is required to have read/write access to NFS shared from a Windows system. By default, the anonymous UID and GID for Client for NFS is set to -2. You can set this value to 0 or to the user/group id of your choice.
Run "regedit" from the command line
→ Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS
        \CurrentVersion\Default
→ Add two DWORD 32bit values: AnonymousUid and AnonymousGid
→ Set theses values to: 0 (or the uid/gid of your choice)
→ Restart the Client for NFS service or the Windows Virtual Machine

  1. Mount the share from command prompt.
    The hard mount option will make nfs retry instead of timing out.
mount -o mtype=hard <NFS_Server_IP>:<Share_Path> <Mount_Point> 

example: to connect to a linux server exporting NFS at ip address 10.0.0.123

mount -o mtype=hard 10.0.0.123:/ofs * 
  1. Verify your mount options, i.e. that UID=0 and GID=0 and mount type is hard, by typing mount in the command prompt window.

Reference


by ObjectiveFS staff, July 24, 2016
ObjectiveFS is a shared file system for OS X and Linux that automatically scales and gives you scalable cloud storage. If you have questions or article idea suggestions, please email us at support@objectivefs.com