Subject: Re: nfs performance

From: [email-masked] (Alan Cox)
Date: Fri, 21 Jan 1994 17:23:49 GMT

Sounds like we need an NFS FAQ

Lets try a first draft - maybe this can be hacked onto a net howto or something

Q1. 	Files get corrupted when using NFS over wider area networks or SLIP

Certain vendors (Sun primarily) shipped many machines running NFS without
UDP checksums. Great on ethernet, suicide otherwise. UDP checksums can be
enabled on most file servers. Linux has it enabled by default from pl13
onwards - but both ends need to have it enabled...

Q2.	My NFS files are all read only

The Linux NFS server defaults to read only. RTFM the 'exports' and nfsd
manual pages. With non Linux servers you may also need to alter /etc/exports

Q3.	I mount from a linux nfs server and while ls works I can't read or
write files.

You must mount a Linux filestore with rsize=1024,wsize=1024 (or 2048 if
you really want - 1024 is a better choice).

Q4.	I mount from a linux nfs server with a blocksize of between 3500-4000
and it crashes the Linux box regularly

I know good isn't it [NOT]. Basically don't do it then. (see Q3).

Q5.	Can Linux do NFS over TCP

No. If someone wanted to spend the time and update the rpc code to add rpc
stream record marking it should work then.

Q6.	I get loads of strange errors trying to mount a machine from a Linux
box. 

Make sure your users are in 8 groups or less. Older servers require this.

Q7.	Linux NFS clients are very slow when writing to Sun & BSD systems

NFS writes are normally synchronous (you can disable this if you don't
mind risking losing data). Worse still BSD derived kernels tend to be
unable to work in small blocks. Thus when you write 4K of data from a Linux
box in the 1K packets it uses BSD does this

	read 4K page
	alter 1K
	write 4K back to physical disk
	read 4K page
	alter 1K
	write 4K page back to physical disk
	
	etc..
	
Better systems don't have this problem. The Linux client is however
quite slow anyway.

Q8.	I've heard NFS is not secure is this true

Yes, totally. Running NFS in an uncontrolled environment is rather like
leaving your front door open, painting 'On holiday' on your house and posting
maps to every known criminal...
In a fairly secure environment or when you can recover data from stupid
misuse its pretty much OK. The worst someone can easily do is alter all the
files on an NFS mounted disk and/or crash the machine. So long as you don't
mount your system files writable you should be vaguely safe

Q9.	I occasionally mount from lots of different places do I have to set
the all mounted each boot.

No you can use the automounter to mount disks as you access them.

Q10.	How do I stop things hanging when a server goes down

There are three main NFS behaviours

soft:	Your NFS client will report an error to the process concerned if an
	NFS server doesn't answer after a few retries. Most software handles
	this well - but not all.
	
hard:	Your NFS client will try forever unless killed off. Operations will be
	restarted when the NFS server recovers or reboots.
	
hard,intr:
	As hard but ^C will also stop the NFS retrying. In a few cases - notably
	nfs mounted /usr/spool/mail disks this doesn't help as the shell will
	be ignoring ^C when it checks you have mail...