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.
Server Configuration
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/installs jimslinux(rw,no_root_squash)
/data/docs *.mycompany.com(ro,root_squash)
/data markslinux(rw,no_root_squash) tomscomputer(ro)
/tftpboot linux3(ro,no_root_squash)
/data tedslinux(ro,no_root_squash)
|
|
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:
/tftpboot/lts/ltsroot 10.1.0.101/255.255.0.0(ro,no_root_squash)
/tftpboot/lts/ltsroot 10.1.200.1/255.255.0.0(ro,no_root_squash)
/tftpboot/lts/ltsroot 10.1.200.2/255.255.0.0(ro,no_root_squash)
/tftpboot/lts/linux3 10.1.200.2/255/255.0.0(rw,no_root_squash)
The format of the file is:
directoryname hostname(options)
The hostname can be the IP address followed by the netmask as shown above.
Options include:
- 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.
Client Setup
To set up the client side on a fully functional Linux machine type "mount -o rsize=1024,wsize=1024 mymachine:/data /mnt/mymachine/data
|