NFS
From Docunext Technology Wiki
Contents |
Summary
NFS is pretty sweet for convenient, insecure, access to remote files. I say insecure, but with tunnels and VPNs, NFS can be made more secure.
NFS Server
Setting up an NFS server is probably easier than you might think. Here's some important components:
Mounting an NFS Export
Similarly, mounting an NFS export can be easy too! I needed to install nfs-common and portmap on the client. Then, its as simple as:
mount nfs.example.com:/path/to/export /target/mount
It can also be done with /etc/fstab:
172.16.2.47:/ /home/all/nfs nfs4 _netdev,noatime,rsize=8192,wsize=8192,user,hard,rw,timeo=4,intr,proto=udp 0 0
Debugging NFS
# nfsstat --rpc Server rpc stats: calls badcalls badauth badclnt xdrcall 13381 0 0 0 0 Client rpc stats: calls retrans authrefrsh 0 0 0
Get a List of all NFS Clients
cat /var/lib/nfs/rmtab
or (from server):
showmount localhost
unable to register (statd, 1, udp) *RESOLVED*
I was setting up NFS once and I ran into an issue where nfs-kernel-server wouldn't start. Syslog reported this:
May 19 13:48:56 server rpc.statd[16714]: Version 1.1.2 Starting May 19 13:48:56 server rpc.statd[16714]: unable to register (statd, 1, udp).
I couldn't figure it out, but was able to resolve it by stopping nfs-common and portmap, and then starting portmap first, verifying it was running with this command:
# rpcinfo -p localhost
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
And then starting nfs-common (/etc/init.d/nfs-common start), checking rpcinfo again, and then starting nfs-kernel-server.
NFS Stale File Handle
I'd seen this error in the past, but only when something between the client and the server was disrupted. More recently I saw it happen when the NFS connection was going through a load balancer which made the server believe that only one client was connected. In fact, I'm surprised that worked at all. Even more odd was that after a network re-design, the problem persisted, apparently because the server was running Ubuntu 10 and the client was running Ubuntu 8! Odd, indeed. Another caveat is that the server is running encfs under the NFS mount.
NFS Related Operating Systems
FreeBSD Based
OpenSolaris Based
See Also
- PXE Boot
- FreeNAS
- PC Engines Geode Kernel with NFS
- Autofs
- NFS Ganesha
- NFS User Server
- NFS Optimization
- Unfs3
Docunext Blog Posts
- OpenVZ CT = "mount.nfs: No such device" *RESOLVED*
- http://www.docunext.com/blog/2007/10/nfs-stuff.html
- http://www.docunext.com/blog/nfs/
Links
- http://www.troubleshooters.com/linux/nfs.htm
- http://stromberg.dnsalias.org/~strombrg/NFS-troubleshooting-2.html
- http://www.digitalpeer.com/id/linuxnfs
- http://linux.derkeiler.com/Mailing-Lists/Debian/2008-05/msg02182.html
- http://www.mail-archive.com/debian-devel@lists.debian.org/msg128502.html
- http://www.crazysquirrel.com/computing/debian/servers/setting-up-nfs4.jspx