How to Setup NFS (Network File System) on RHEL/CentOS/Fedora and Debian/Ubuntu

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux course in 5 Days

We are thankful for your never ending support.

Tarunika Shrivastava

I am a linux server admin and love to play with Linux and all other distributions of it. I am working as System Engineer with a Web Hosting Company.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

74 Responses

  1. bin sharif says:

    hi
    i want to know about mount command

  2. irfu says:

    I’m learning Linux.

    I have created users in /home/export directory server side, exported and shared to particular ip address..
    On client side I have mounted that directory to home directory and I got error i.e,

    No such file or directory on /etc/fstab

    1. is this possible to share the user’s in NFS?
    2. if s please let me know solution for above process?

    • Ravi Saive says:

      @Irfan,

      You can’t mount to /home directory, you can only mount all external drives under /mnt directory, try mounting NFS share directory to /mnt and then see..

  3. keith terrill says:

    I am using Linux Mint 17.3

    When I enter the command:
    —————————————————————————–
    $ sudo apt-get install nfs-utils nfs-utils-lib
    —————————————————————————–

    I get:
    —————————————————————————–
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package nfs-utils
    E: Unable to locate package nfs-utils-lib
    —————————————————————————–

    • Ravi Saive says:

      @Keith,

      Sorry for trouble, it seems in Linux Mint 17.3, you should follow these commands to install NFS.

      $ sudo apt-get install nfs-kernel-server rpcbind nfs-common
      

      We will update this article with new instructions to support newer version of Ubuntu and Mint distributions.

  4. Ashutosh Bhadoria says:

    Thanks a lot Tarunika precise and concise explanation, very much appreciated

  5. BV.Naagabaabu says:

    is it possible to use CentOS-6 as NFS server and CentOS-7 as NFS client. I tried like this. But i got the following error.
    mount.nfs: access denied by server while mounting 192.168.1.73:/mnt/nfs_1

    at the same time when i mounting NFS shares in a CentOS-6 version client it is fine and it is successfully mounted. But getting problem while mounting in CentOS-7 client.

    • Ravi Saive says:

      @Nagababu,

      It seems you’ve to play with iptables, have you opened port 2049 on firewall? or else stop the iptables and give a try..

      • BV.Naagabaabu says:

        Got it….Both nfs server(centos 6) and client(centos 7) i’m using are in same VMWare. But while using one of my servers having centos 7 as nfs client., it was mounted successfully. Seems there is something to set in network in vmware.

        Thanks.

  6. BV.Naagabaabu says:

    How can i specify size to the nfs shared directory. After mounting nfs shared directory in client system and using df -h command., it is displaying entire nfs server filesystem size as nfs shared directory. So how to specify some particular size to the nfs shared directory in nfs server. Is it possible.

    • Ravi Saive says:

      @Nagabab

      Could you please share the screenshot or output of the df -h command so that we can better understand your problem and also it seems that you’ve added the entire filesystem in /etc/exports file, better just place the shared directory name.

      • BV.Naagabaabu says:

        i just added the shared directory in /etc/exports in nfs server. here is the output of df -h -F nfs in client system
        nfs server : 192.168.1.73
        nfs client : 192.168.1.36

        [root@localhost nfs_mount]# df -h -F nfs
        Filesystem Size Used Avail Use% Mounted on
        192.168.1.73:/mnt/nfs_1 28G 7.8G 19G 31% /home/temp/nfs_mount

        Here is the /etc/exports file contents in nfs server
        /mnt/nfs_1 192.168.1.36(rw,sync,no_root_squash)

        Nfs server is a centos in vmware. It has 30 GB of total size.

        • Ravi Saive says:

          @Nagababu,
          wh
          Thanks for sharing the NFS configuration, it seems that nfs share under /mnt filesystem and you’re looking for directory size, so here instead using df command, try using du command which shows disk usage of directory..

  7. sap says:

    Hi Tarunika,
    Thanks for the step by step writeup.
    I have a issue after mounting shared nfs directory on the client.
    The owner and group of /mnt/nfsshare changes to 1002
    drwxrwxr-x 103 1002 1002 4.0K Jan 19 12:08 nfsshare

    Tried changing it as root but operation is not permitted. What thing am I missing?

    • Ravi Saive says:

      @Shantanu,

      Are you trying to change the permission of a mounted nfs share on client machine using root user? if yes, that’s not possible, because the device is just mounted on the client machine with given rights in export file, so only the creator of share directory will have access to modify the permission..

    • Tikken says:

      Sap,
      The uid & gid seen on the client would normally be the same as seen from the server. The difference might be that the user accounts on each of the hosts doesn’t match one anothers’ uid/gid.
      For nfs, it’s important for the user accounts sharing their data via nfs to be identically configured.

  8. Taylor Marks says:

    These yum commands have worked for me for several months. Sometime between when I last ran them in December and when I ran them yesterday, they suddenly broke. Now when I use:

    yum -y install nfs-utils-lib

    I get an error message saying: No package nfs-utils-lib is available.

    Any idea why this is happening or how to fix it?

    • Ravi Saive says:

      @Taylor,

      I’ve just tried to install nfs-utils-lib package using yum command on my CentOS 6 and 7 servers and the package is available to install. May I know on which CentOS based distribution you’re trying to install? could you post the whole output of yum command?

  9. David says:

    Great Tutorial!
    But my question is, how can i give a specific user access to a specific NFS folder?

  10. hanumaiah says:

    we are looking for quantum tape drive mount in RHEL6.5 anyone help us

    • Ravi Saive says:

      @Hanmaiah,
      Sorry no idea about quantum tape drive, mount I think you can use mount command to mount the tape drive with the help of its device name, which you can get by fdisk or lsblk command.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 150K+ Linux Users
  1. 100,756
  2. 5,113
  3. 36,418

Enter your email to get latest Linux Howto's