Export a filesystem
1 aptitude install nfs-kernel-server
Create an entry in
1 # /etc/exports: the access control list for filesystems which may be exported 2 # to NFS clients. See exports(5). 3 # 4 # Example for NFSv2 and NFSv3: 5 # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) 6 # 7 # Example for NFSv4: 8 # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) 9 # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) 10 11 /media/space/tmp 192.168.182.0/24(rw,sync,no_subtree_check)
1 exportfs -av
Simple manual mount
1 aptitude install nfs-common
Information about NFS mounts
1 nfsstat -4 -s
1 mountstat /path/to/mountpoint
Mount options only state, who is able to mount the filesystem. Please see man 1 mount for user, group, users and owner.
Permissions like reading and writing are handled by filesystem permissions.
Please think twice, before you chown a directory recursively and destroy the remote permissions.
You may always ask yourself, if it is really necessary to mount the whole tree. Maybe a subtree is sufficient. And this subtree permissions may more likely be changed recursively.
Two systems may both write on the same filesystem one with user permissions and one of its group.
For usage of the more flexible Posix-ACLs a additional package is necessary.
This contains the
Increase client read and write size (Default: 65536, 64KiB) to 1MiB
1 mount -o rsize=1048576,wsize=1048576 source:path mount/point
/proc/sys/net/core/ contains the tuneable for some network buffers that may optimize performance.
grep -H "" /proc/sys/net/core/*mem*
Maximum value is 2^31-1 = 2147483647 Let's try the maximum on server and client
You may persist this config across reboots with a file in /etc/sysctl.d
Other paths with info and tuneables:
Soft vs Hard
Determines the recovery behavior of the NFS client after an NFS request times out.
The mount type determines how the NFS client handles a crash of a NFS server.
If neither option is specified (or if the hard option is specified), NFS requests are retried indefinitely.
No error is reported by the NFS client to the application.
1 mount -o hard,intr server:/path/to/share /media/nfs/share
It is recommended to be combined with an additional flag intr to make the IO-operation interruptible. The option is obsolete after Kernel 2.6.25, as it's hardcoded into the kernel.
To stop the NFS process you need to
- IO-operation is stalled (and the process might even freeze) until the NFS server reappears
- Data integrity ensured
- The operation is continuously tried and may impose a significant amount of traffic
If the soft option is specified, then the NFS client fails an NFS request after retrans retransmissions have been sent, causing the NFS client to return an error to the calling application.
tcp -> 600 [deciseconds]
1 mount -o soft,timeo=5,retry=5 server:/path/to/share /media/nfs/share
- Fast response
- Preserves client responsiveness.
- Data integrity is put at risk
- Async caches are problematic.