Problem
How do I get started with NFS? Solution
The purpose of this article is to show how to set-up and test NFS between different platforms.
The steps are also relevant to earlier versions of the SCO Unix platform.
In this first instance, we shall share and mount as root as a proof of concept.
Sharing:
-------
Let's assume that we want to share a drive on our SCO unix server
and mount it from another server, as root.Let's assume we want to share, or export, /local/tmp and then we can mount it to /local/mnt.
First, run:# mkdir /local (if it's not already there)# mkdir -p /local/tmp
# mkdir -p /local/mnt
# chmod 777 /local/tmp
# chmod 777 /local/mnt
# cd /local/tmp
# touch aYou can use the "scoadmin File Manager" to manage this or use the commands below.
OpenServer5 and earlier versions of UnixWare7 use NFS Version 2 OpenServer6 and UnixWare 7.1.4 use NFS Version 3.
To do this we run:OSR5:# exportfs -v -o anon=0,rw /local/tmp(# exportfs -u /local/tmp) will un-export it.
OSR6/UW7:# share -F nfs -o anon=0,rw /local/tmp(# unshare /local/tmp) will un-share it.# share- /local/tmp anon=0,rw ""and check with:# exportfs- /local/tmp anon=0,rw ""and:# showmount -e localhost/local/tmp (everyone)If "localhost" or the server name is not found then you are likely to see:
UX:showmount: ERROR: localhost server not responding for clnt_create: RPC: Name to address translation failed - n2a: hostname not found
Now, there are consequences to setting anon=0.
There are reasons that root's privileges are lowered across NFS.
When you set 'anon=0', you are giving root privileges to all anonymous users.
It is recommended, for production, to setup an nfs account and assign the anonymous user that UID or continue testing by dropping the "anon=0" entry and all new files will be created by the user "nobody".
For example, use an account 'nfsdata' and assigned nfsdata's UID to anonymous.
There is more info on this here:
http://osr600doc.xinuos.com/en/NET_nfs/nfsT.automatic_privs.htmlIt is recommended to use 60001 for the UID because under UW7, this is the UID for the account 'nobody' and the GID for the group 'nobody'.
For OSR6, the account 'nouser' uses UID 28 and the group 'nogroup' uses GID 28.
Mounting:
--------
Then to mount your shares from this server first then other servers
run:OSR5/OSR6:# mount -f NFS <remote server>:/<share> /<local mount point>UW7:# mount -F nfs <remote server>:/<share> /<local mount point>eg. In our example, the "share" is /local/tmp and the "local mount mount" is /local/mnt
(umount /local mount point) will un-mount the share.
eg. # umount /local/mnt (Make sure you are not in the directory otherwise you will see "Device Busy".
The mount must be run by root but can be used by all.
Files created by root are owned by the anonymous user unless "anon" is set to 0 which is the root account otherwise they are owned by the UID which has created them.
Testing:
-------
You should then be able to change to /<local mount point> and
create a file and delete it.If not, then check the file permissions of /local and any subsequent directories to ensure you have permission to access the files there.
Troubleshooting:
---------------
- Errors such as Invalid argument and permission denied are often
caused because you have not shared the file system as "anon=0"The 'root' account is treated as a non-privileged anonymous user
in NFS. For root to have root privileges you need to add anon=0.- Getting "UX:nfs mount: ERROR: could not bind to reserved port"
Causes: a) rpc isn't running which you can see with "rpcinfo -p"
b) Firewall issues blocking connectivity. You can check by creating a share on 'this' machine and mounting to it using NFS on 'this' machine.
If you can mount it locally then the problem is remote.
2049 is the main port, but there is also 111 and the lockd & statd ports may change depending on platform.
Does netstat show the ports listening?# netstat -an| egrep "111|2049"If you restart the services then if the port is allocated to another service then it will complain.
c) The server may be out of TCP/IP resources which may be resolved by re-starting the server or RPC & NFS services from /etc/rc2.d.
The server may need some TCP/IP tuning done from:
TA 114966- From OpenServer5:The following has been seen connecting to a Windows 2008 Server, although, reportedly this is not an issue for Windows 2008 R2 Server or Windows 2003 Servers:
WARNING: NFS lookup failed for server<x>: AUTH ERRORThen with or without the Anonymous checked on, on the Windows 2008 share, we get a Permission Denied error when trying to write a file and are unable to see any files when running a "ls -al".
(Please note the same effect can be seen when trying to mount a Windows 2008 server share from a Windows 2008 server).
- From OpenServer6:UX: nfs mount: ERROR: <server>/<share>: server not responding for clnt_create: RPC: Timed out
a) Remove TCP/IP from netconfig and re-add it double checking the spelling etc of the host and fqdn.
b) Check /etc/hosts and made sure the entries are in the following format:
<IP> <NAME>.<FQDN> <NAME>c) Stopped /etc/rc2.d/S87nfs and S86rpc and then restarted S86rpc and S87nfs.
- From Unixware7:ERROR: <nfs_client> server not responding for clnt_call: RPC: Unable to receive; Connection refused; event requires attention.
The protocol of the server serving NFS doesn't understand your NFS protocol.
This has been seen when UnixWare 7.1.1-7.1.4/OSR6 has tried to
mount a file system shared by a Windows 2008 Server and Windows
2008 R2 Server.- From Windows TO SCO Unix:Connecting from a Windows 2003/2008/Vista/Windows 7 machine to
a SCO Unix Server. You can run:# showmount -e <unix server>It is necessary to run:# mount -o anon \\<unix server>\<share> *(Where * is the next available drive letter)Alternatively, the "net use" command can also work to mount the NFS share.
- FOR WINDOWS 2008 and WINDOWS 2008 R2:
------------------------------------- If you experience issues going to OpenServer5 or UnixWare 7.1.1 and get:
Network/System Error 53 which means the network path was not found.
To rectify this, we need to tell the client to not use NFS version 3 by creating a DWORD value called DisableV3 and setting it to 1 under the following registry key -
HKLM\Software\Microsoft\ClientForNfs\CurrentVersion\DefaultNow run the following commands to restart the NFS client on the Windows system -
NFSADMIN CLIENT STOP
NFSADMIN CLIENT STARTSee: http://blogs.technet.com/b/sfu/archive/2009/07/17/windows-vista-and-older-nfs-servers.aspxhttp://blogs.msdn.com/b/sfu/archive/2008/12/15/set-up-services-for-network-file-system-in-windows-server-2008.aspxhttp://blogs.msdn.com/b/sfu/archive/2007/04/19/mounting-nfs-share-on-nfs-client.aspx- Access is deniedIt's likely you are attempting to access a share as root and not
as a user. Share you SCO Unix filesystem without "anon=0".- For other OSR6/UW7 Verions:Implement the following registry change in "regedit":
AnonymousUid/AnonymoudGid DWORD values under
HKLM\Software\Microsoft\ClientForNFS\CurrentVersion\Default using Registry
Editor.Set these values to 60001 and restart NFS service on Windows using nfsadmin command.
NFSADMIN CLIENT STOP
NFSADMIN CLIENT START- For UnixWare 7.1.1I can mount the NFS share but if I try to create, amend or delete a file I continue to get "Access is Denied" although I have followed the above instruction.
Share you filesystem with "NETPATH=tcp" as "udp" is the default protocol.
eg:# NETPATH=tcp share -F nfs -orw /localthen mount from Windows 2008 with:C:\ MOUNT \\<UW711 SERVER>\local Z:You should then be able to change to Z: and create, amend or
delete files. The ownership of the files under Unix should be
owned and grouped as "nobody".- In general Windows NFS needs to be configured using the following guidelines:
To Access a SCO Unix Server with NFS from Windows 2008 R2:
http://technet.microsoft.com/en-us/library/cc753302(WS.10).aspx- Also ensure the SCO Unix server's name is accessible from the Windows 2008 server via either DNS or via Windows 2008 Host's file which can be configured with:
http://support.microsoft.com/kb/972034- The following hotfix is used to access Unix servers running V2 NFS services from Windows 2008 R2 and Windows 7:
http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2257487&kbln=en-usThis hotfix is reportedly unavailable currently for Windows 2008.
NOTES: The following warnings have been seen during NFS operation in the
/usr/adm/messages file and can be ignored:WARNING: xdr_opaque: decode FAILED WARNING: xdr_fhandle: decode FAILED WARNING: xdr_rddirargs: decode FAILED
NOTES: For tuning NFS please see:TA 102447 See also
http://osr600doc.xinuos.com/en/NET_nfs/CONTENTS.htmlTA 109623TA 113641