Network File Share (NFS) is a protocol for sharing storage. It is quite common in Network Attached Storage (NAS) devices and is a standard compared to Samba which is Microsoft specific but has been ported to Linux.
Install the relevant software:
sudo apt-get install nfs-kernel-server nfs-common portmap
Configuring NFS server is relatively simply. Edit the file /etc/exports file and add all the directories available as a share. The format should be as follows
/media/cdrom 192.168.0.1/24(rw,async)
Using the above string this would share the CDROM to any computer with the IP range 192.168.0.1-192.168.0.254 that has read and write permissions and requests can be process asynchronously.
Specific IPs can be given to each share like this:
/media/cdrom 192.168.0.1(rw,async) 192.168.0.1(ro,async)
Computer 192.168.0.1 has the permissions described in the above example and the computer with 192.168.0.2 only has asynchronous requests and read only access to files for that share.
When specifying mount points note where the spaces are and are not because spaces are read by the system so
/media/cdrom 192.168.0.1 (rw,async)
is invalid because there is a space between the IP address and the parenthesis.
Once all the shares have been configured it is necessary to restart NFS to see the changes:
sudo /etc/init.d/nfs-kernel-server restart
Install the NFS client if the computer does not have a NFS server itself:
sudo apt-get install portmap nfs-common
To mount the share manually from the terminal type the following:
sudo mount 192.168.0.1:/media/cdrom /media/share
First is super user command sudo then mount command, IP address of NFS server followed by the path to share. The last parameter is the local mount point so in the above example it will mount the CDROM drive from the server onto /media/share directory of the client computer.
To make the mount more permanent edit the /etc/fstab file and the following line, one for each NFS share.
192.168.0.1:/media/cdrom /media/share nfs rsize=8192,wsize=8192,timeo=14,intr
The only part that needs to be changed is the IP address, NFS share point and the mount point. This is highlighted in bold in the example above. The rest should be fine left as is. This change should mount the share when the computer is started.
NFS support does not come as standard with Windows so it has to be installed. Also I only found the feature in Windows 7 Ultimate Edition and not the Professional. I believe there is a Business Edition in between but do not know if it has the support for NFS.
Go to the Control Panel and on the left hand side click on Turn Windows features on or off hyper link. It will load a list of software in a tree / node structure. Find Services for NFS and tick Client for NFS as a minimum.
On the start menu right click on Network and select Map network drive. If this option is not in the start menu go to Computer and right click on Network from the left hand panel. A wizard will start for mapping a network drive.
Select the drive letter to be assigned to the NFS share and for the Folder enter the address [server]:[path] for example 192.168.0.1:/media/cdrom
Tick Reconnect at logon if you want it to connect on start up and click Finish to end the wizard.
The only problem with mounting the NFS on Windows is every time Computer it takes a longer to scan and load the drives because it scans the NFS to get the size and amount used on the NFS.
NFS between Linux machines is perfect and a good way to share files. Mounting a NFS makes the local share look as if it was it was local drive.
For Windows I’d stick to using Samba because it doesn’t take a while to scan the shared drive every time the drive is highlighted to get the drive information such as amount of space available. It’s not a nice to administer two services doing the same thing but it works.
NFS Server and Client Configuration in Ubuntu