This guide covers the steps to share your ObjectiveFS filesystem from Linux to Windows via NFS. For Samba instructions, see this guide.
Mount your objectivefs filesystem (e.g. on /ofs).
$ sudo mount.objectivefs <your filesystem> /ofs
Install NFS server.
$ sudo apt-get install nfs-kernel-server
$ sudo yum install nfs-utils
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)
Increase the number of threads on the NFS server.
/etc/default/nfs-kernel-server
RPCNFSDCOUNT=<number of threads> # e.g. 64
/etc/sysconfig/nfs
RPCNFSDCOUNT=<number of threads> # e.g. 64
Restart the service.
$ sudo service nfs-kernel-server restart
$ sudo service idmapd restart # you may also need to restart idmap
$ sudo /etc/init.d/nfs restart
Verify that the Linux server’s NFS port is open for connection from the Windows server.
These steps are for Windows Server 2012 R2.
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
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
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 *
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.
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