| « HOWTO Setup autofs on Fedora | HOWTO:Reinstall Grub2 on Ubuntu » |
The Network File System (NFS) was developed to allow machines to mount a disk partition on a remote machine as if it were a local disk. It allows for fast, seamless sharing of files across a network.
I stopped using NFS for remote file systems. When I got autofs working. See my FIXME: update autofs howto and put link here.
The Official HOWTO for NFS is very good you should read it. ![]()
...
Install the required rpms and a little GUI app for looking after the directories you want to share.
Make tell the system to start the NFS service at boot time. This will set the configuration for all run level to start and or stop NFS as specified by the NFS authors.
Check that the service will at boot time
We can now use the GUI or edit the config file directly to setup some shares. I prefer to edit the files directly as server installs do not usually have X installed and therefore there will be no chance or running a GUI.
.
Below is an example of sharing two directories. They are only visible to machines on the local subnet 192.168.0.X. Note the netmask can be written in full of in the abbreviated form. (Why is the word "abbreviated" so long?) Take a look at the man page exports(5) for more details on the options and format of the exports file. Note that white space CAN be significant in the exports file, which is unusual.
After saving the exports file we need to tell the system that they should be exported, us the following command. We only really need the '-ra'. The extra -v turns on verbose mode so we can see what have been exported and how.
The NFS service can be turned on and off like any other service with stop, start, restart. Use status to see if it is already running. There are a number of other options too.
directories that have been shared on another machine can be mounted in a similar way to local disks or storage devices. But first you need to know what is being shared.
To see what shares are available from a remote machine use:
Okay, so now we know that linux32 is exporting two shares /home and /data. This will only be useful to us when wee can access the shares from our machine. This we do by mounting them somewhere on our file system. To mount a file system we need a mount point, which is a directory that will be the root of top level for that share.
These NFS directories can be unmounted with
These will remain mounted until the machine is rebooted. To make them permanent, that is, they are automatically mounted at boot time. We add an entry to /etc/fstab.
linux32:/data /mnt/data nfs rw,hard,intr,rsize=32768,wsize=32768 0 0
It is a good idea to test this before a reboot in case a mistake was made. Simplest way is to mount all drives not yet mounted in the fstab.
If all goes well you will be able to access the mount points. Why not try rebooting and double check while everything is still fresh in your mind.
man pages for NFS, showmount, fstab, mount and umount
As usual there is some good information to be found at fedoraproject.org