Blog

How to create an NFS share on Linux

How to create an NFS share on Linux

Copyright © TechPad.co.uk

If you're sharing files with other Linux or Unix machines NFS is the software of choice. Here's a simple guide to configuring an NFS share on your server and mounting it from your client machine.

NFS uses a server and a client, so you'll need to configure both the machine with the directory you want to share and the client machine on which you want to mount the share. 

Step 1: Install NFS on your server

First you'll need to install the nfs-kernel-server package on your server, the nfs-common package and portmap. On Debian Linux this is a simple one liner. When prompted, don't use the loopback option for portmap.  

apt-get install nfs-kernel-server nfs-common portmap 

Step 2: Create an NFS export on your server

Now you've got NFS and portmap installed you'll need to configure NFS so that it shares or exports the desired directories. As root, you'll need to edit the file /etc/exports and add a line with your share definition. I want to share the directory /storage with all machines on my LAN with an IP starting from 192.168.0.1 to 192.168.0.100. I want all machines to have read and write access. 

/storage 192.168.*(rw,no_root_squash,async,no_subtree_check)

 

Step 3: Restart the NFS server

In order for the changes to take effect you'll need to restart the NFS server. You can do that with the following command, issued as root: 

/etc/init.d/nfs-kernel-server restart 

 

Step 4: Install the NFS client on your other machine

In order to use NFS on the client machine you'll need to install it. This is as easy as apt-get install portmap nfs-common. 

 

Step 5: Create the NFS share mount point 

As with most things on Linux, in order to mount anything on your machine you simply create a directory and then tell the machine to use that as your mount point. Create a directory in the location at which you want to mount your NFS share, I went for /media/NFS.

To mount this, you'll need to edit the /etc/fstab file and add an entry similar to this:

mediavault.local:/stroage /media/NFS nfs rsize=8192,wsize=8192,timeo=14,intr

Once you've saved that, as root, issue the following command and you should find that your NFS share is now available on the client machine. 

Step 6: Troubleshooting

If you receive an error message such as "mount.nfs: mount to NFS server '192.168.0.99:/storage' failed: RPC Error: Program not registered" you'll need to ensure that your share definition on the server uses something like 192.168.*, not a more specific IP address.

 



Published: TechPad.co.uk Monday 2 November 2009, 8:44 pm
Views: 231 times
Filed under: Linux Debian servers NFS networking

(No votes yet)



Login to leave your comments

Please login

Username
Password
  Remember me
Reset password | Send activation code

Related items

Auto-NDISwrapper eases Linux wifi
Auto-NDISwrapper eases Linux wifi
The easylinuxwifi.org project has launched... no votes (No votes)
Twitter growing rapidly in UK
Twitter growing rapidly in UK
While many regard it as pointless, the UK ... no votes (No votes)
How to install software on Ubuntu Linux
How to install software on Ubuntu Linux
Ubuntu is one of the easiest Linux distrib... 5 (1 vote)
How to keep your Ubuntu Linux system up to date
How to keep your Ubuntu Linux system up to date
Ubuntu makes it really easy to keep your s... no votes (No votes)
Watch digital TV from your computer with Zattoo
Watch digital TV from your computer with Zattoo
Zattoo makes it possible to watch terrestr... no votes (No votes)

Recently added

How to create a Linux iPlayer download GUI using Zenity
How to create a Linux iPlayer download GUI using Zenity
Here's how I created a simple graphical ut... no votes (No votes)
A taste of iPhone support coming in Ubuntu Lucid Lynx
A taste of iPhone support coming in Ubuntu Lucid Lynx
Ubuntu's Lucid Lynx release, which comes o... no votes (No votes)
Frequently asked questions on NexentaCore
Frequently asked questions on NexentaCore
Frequently asked questions about NexentaCo... no votes (No votes)
Create a video transcoder GUI with Zenity and ffmpeg
Create a video transcoder GUI with Zenity and ffmpeg
Create a GUI application for your Linux co... 4 (1 vote)

Most viewed


Recent comments


Analytics sites

SiteScan by EpikOne
SiteScan by EpikOne
SiteScan is a diagnostic to...
Visual Revenue blog
Visual Revenue blog
Interesting web analytics, ...
Excellent Analytics free Excel plugin
Excellent Analytics free Excel plugin
Excellent Analytics is a si...