Lesson 5

Date: 2/19/2009
Network File System (NFS)
Linux for Engineering and IT Applications


Exercises with NFSv4

  • NFSv4 exports exist in a single pseudo filesystem, , where the real directories are mounted with the --bind option.

    Create the export filesytem on the NFS server (the node machine):
    mkdir /export
    mkdir /export/users
    mkdir /export/software
    

    Create and mount the real users directory with /export/users :
    mkdir /home/NFSv4
    mkdir /usr/software
    mount --bind /home/NFSv4 /export/users
    mount --bind /usr/software /export/software
    
    To survive a reboot, the mount can be added into /etc/fstab
    /home/NFSv4    /export/users   none    bind  0  0
    /home/software    /export/software   none    bind  0  0
    

    In /etc/default/nfs-kernel-server we set:
    NEED_SVCGSSD=no
    

    In /etc/default/nfs-common on both the server and the client
    NEED_IDMAPD=yes
    NEED_GSSD=no 
    

    Restart /etc/init.d/nfs-common on both the server and the client:
    /etc/init.d/nfs-common restart
    

    Export the directories on the server: in /etc/exports, put
    /export desktop01(rw,fsid=0,insecure,no_subtree_check,async)
    /export/users desktop01(rw,nohide,insecure,no_subtree_check,async)
    /export/software desktop01(rw,nohide,insecure,no_subtree_check,async)
    
    You can keep /home/exports desktop01(rw) for NFSv3 in /etc/exports.
    /etc/init.d/nfs-kernel-server restart
    


    On the client, create a mounting point and mount the directory from the NFSv4 server:
    mkdir /home/NFSv4
    mount -t nfs4  node01:/ /home/NFSv4
    
    See mounted directories
    df -h
    

    Check the file system types
    mount
    

    Notice that directories users and software appear under /home/NFSv4
    ls -l /home/NFSv4
    

    References:NFSv4Howto on Ubuntu


  • Take me to the Course Website