What I’ve recently learned is how to use NFS to share folders between two Red Hat Enterprise Linux 5 machines. They are both on the same network and for simplicity have had firewall disabled (firewall settings were not required in my setup). Below are some tips I used on each of the respective machines in no particular order. Additionally, all steps were performed using the root login.
Machine A (contains file to share)
- Make sure NFS service is running. You can do this by typing ps aux | grep nfs in the terminal.
- To start the NFS service, type /etc/rc.d/init.d/nfs start or /etc/rc.d/init.d/nfs restart in the terminal.
- If you want the NFS service to start automatically at boot up, add /etc/rc.d/init.d/nfs start or /etc/rc.d/init.d/nfs restart to the /etc/rc.d/rc.local file.
- Next, we need to specify the share specifics. This involves specifying the folder path, the remote machine (Machine B), and the share permissions. The information goes into /etc/exports. Use the following format: /mnt/shareThisFolder machineBName(ro). After updating the file, make sure to restart the NFS service (#3 above).
Machine B (wants access to remote files)
- We need to mount the folder we shared earlier on Machine A. The changes go into /etc/fstab file. We need the remote machine name, remote filepath (should be same as the earlier specified location), local filepath. Use for the following format: machineAName:/mnt/shareThisFolder /mnt/filesFromMachineA nfs rsize=8192, wsize=8192,timeo=14,intr 0 0. After saving the file, type mount -a in the terminal to start the share.
Troubleshooting:
- Some issues I kept running into was mount failed XXXXXXXX, reason given by server permission denied. This happened to me because though I had started the NFS service on Machine A, I had failed to specify the folder to share. After adding those details (and restarting the NFS service), I was able to mount from Machine B.
- NFS has been working for a few weeks, but has suddenly stopped working. The host computer had been rebooted. The solution is to run the following under the root account in this order:/etc/rc.d/init.d/nfslock restart
/etc/rc.d/init.d/portmap restart
/etc/rc.d/init.d/nfs restartMake sure none of the operations failed, then try remounting. A more long term solution to this is to insure that nfslock, portmap, and nfs autostart during RHEL bootup. Type /usr/sbin/ntsysv from the terminal and make sure those three are checked!
RSS Feed
Posted in
Tags: 
