Linux Beginners Guide to NFS Mount Using Exportfs

by SathiyaMoorthy on October 13, 2010

Using NFS (Network File System), you can mount a disk partition of a remote machine as if it is a local disk. This article explains how to export a file system to a remote machine and mount it both temporarily and permanently.

1. Export File System to Remote Server using exportfs

To export a directory to a remote machine, do the following.

  • REMOTEIP – IP of the remote server to which you want to export.
  • : – delimiter
  • PATH – Path of directory that you want to export.

2. Mount Remote Server File System as a Local Storage

To mount the remote file system on the local server, do the following.



  • REMOTEIP – IP of the remote server which exported the file system
  • : – delimeter
  • PATH – Path of directory which you want to export.

3. Unmount Remote File System

Umount the remote file system mounted on the local server using the normal umount PATH. For more option refer to umount command examples.

4. Unexport the File System

You can check the exported file system as shown below.

# exportfs

To unexport the file system, use the -u option as shown below.

# exportfs -u REMOTEIP:PATH

After unexporting, check to make sure it is not available for NFS mount as shown below.

# exportfs

5. Make NFS Export Permanent Across System Reboot

Export can be made permanent by adding that entry into /etc/exports file.

# cat /etc/exports

6. Make the Mount Permanent Across Reboot

mount can be made permanent by adding that entry into /etc/fstab file.

# cat /etc/fstab    /mydata   ext3    defaults   0 0

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 4 comments… read them below or add one }

1 MfM October 13, 2010 at 7:51 am

“ /mydata ext3 defaults 0 0″
Regarding ext3 in the fstab line: are you supposed to know the remote filesystem? Or is it an indication of the local filesystem you want to use? Shouldn’t it be nfs instead of ext3 or whatever else?

2 Johan Volkers October 13, 2010 at 8:31 am

As far as I know /mydata ext3 defaults 0 0
is not correct
It should be /mydata nfs defaults 0 0

Or even better /mydata nfs intr,soft defaults 0 0

Omitting intr,soft means the system will hang if is not avalable

3 Trax December 31, 2010 at 9:51 am


What about “_netdev” value impact on timeout / no response?? /mydata ext3 defaults _netdev 0

4 yogesh July 20, 2012 at 4:41 am

sir I won 2 know ….. how to work with exportfs -o option…

Leave a Comment

Previous post:

Next post: