Main Menu

Search

LINUX: How Make Directory As Mountable Share (So That It Can Be Mounted As NFS Share From Other Nodes)?

LINUX: How Make Directory As Mountable Share (So That It Can Be Mounted As NFS Share From Other Nodes)?

Below are steps to make Linux directory a mountable share, so that it can be mounted from other Linux nodes.


  1. Edit /etc/exports file and add entry as follows with the name of the directory to want to make as mountable share.

    /ssd/image *(ro,insecure)

    In above example the directory name is /ssd/image. You can change it to any directory you want.

  2. Restart the NFS service using below command.

    service nfs restart

    For Linux 8 and later versions the command will be as follows:

    systemctl restart nfs-server

  3. Check whether the directory is shown as mountable share. For this run below command.

    cat /var/lib/nfs/etab

    You should see output as follows:

    /ssd/image  *(ro,sync,wdelay,hide,nocrossmnt,insecure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,ro,root_squash,no_all_squash)

  4. If firewalld is running on the node, add NFS services to the firewalld to enable NFS communication to the node from the client nodes. For this run below firewalld commands.

    sudo firewall-cmd --permanent --add-service=nfs --add-service=rpc-bind --add-service=mountd
    sudo firewall-cmd --reload


From the other Linux nodes you can mount the directory from Linux server where you made a directory as mountable using below command.


mount -t nfs -o soft XX.XX.XX.XX:/ssd/image /opt/image


In above command, /ssd/image is the mountable directory and XX.XX.XX.XX is UP address from the Linux host (where above steps were done) and /opt/image is the local mount point on client Linux host.


NOTE:


You may see "clnt_create: RPC: Unable to receive" error on the clients when mounting NFS share. This may happen if the firewalld is running and firewalld rules are not attend to add NFS services.



No comments:

Post a Comment