Linux Network File System (NFS)
Linux Server Setup
NFS requires RPC to operate. The following daemons are run when the linuxconf nfs service is started:
- rpc.rquotad - Enforces the set quotas for remote mounted NFS systems.
- rpc.mountd - Performs the requested mounts.
- rpc.nfsd - Handles the user interface to the kernel module that performs NFS.
To set up the server side:
- Edit the file "/etc/exports" as in one of the examples below.
- Then type "exportfs -a".
- Activate NFS services using linuxconf.
- After making any changes, restart the nfs daemon either by using "linuxconf" or typing "/etc/rc.d/init.d/nfs restart". Also if you want changes to the /etc/exports file to take place immediately, install them with the "exportfs -r" command. Doing this, you will not need to restart nfs for changes to be in effect.
This is an example of an exports file for general use:
/data markslinux(rw,no_root_squash) tomscomputer(ro)
The third line allows markslinux to have full access even at the root level to all files in /data, but tomscomputer has read only access, at the world (other) level.
This is an example of an exports file set up for diskless computers with remote booting:
The format of the file is:
The hostname can be the IP address followed by the netmask as shown above.
- no_root_squash - Allows root users on client computers to have root access on the server. Mount requests for root are not be mounted to the anonomous user. This option is needed for diskless clients.
- root_squash - Requests from root clients are mapped to the nobody user and group ID so they will only have file privileges associated with other.
- ro - read only access
- rw - read write access
There are many more options documented in the exports(5) man page.
Performing the mount from the client
To do the mount on the remote machine:
- On the remote boot machine, "linux3", after making a /tmp/mnt directory on the remote machine "linux3", type "mount -n 10.1.0.100:/tftpboot/lts/linux3 /tmp/mnt -t nfs".
- The -n is only needed if the /etc directory on the remote boot machine is read only.
- The 10.1.0.100 address is the address of the NFS server machine with the filesystem being mounted.
To set up the client side on a fully functional Linux machine type "mount -o rsize=1024,wsize=1024 mymachine:/data /mnt/mymachine/data