NFS How To Mount Shares

From Knowledge76

Jump to: navigation, search

Contents

Overview

NFS, or Network File Sharing, is a method to share files amongst networked Unix and Linux machines. NFS is not difficult to implement but can become complex. For small installations (25 users or less) Novel's open source iFolder is a much better alternative.

This article explains how to mount an existing NFS share to your local computer. We will use three methods:

  • One Time Mount - Mounts a drive for use in your current session. The NFS share will disapear after you reboot
  • Permanent Mount Using fstab - Mounts NFS shares using the fstab file. The NFS share will be mounted each time you boot.
  • NFS Mount via autofs - Uses autofs to mount NFS shares on boot. Autofs mounts the share dynamically when they are accessed. (Coming Soon)


For this scenario we will mount two NFS shares.

Server Name: vader.mydomain.net
Share 1 Server Location: /home/shares/music
Share 1 Local Computer Location: /home/carl/music (This local folder must exist before trying to mount)
Share 2 Server Location: /home/shares/client_files
Share 2 Local Computer Location: /home/carl/client_files (This local folder must exist before trying to mount)


One Time Mount

Share 1 - From your terminal:

sudo mount vader.mydomain.net:/home/shares/music  /home/carl/music

Share 2 - From your terminal:

sudo mount vader.mydomain.net:/home/shares/client_files  /home/carl/client_files


Permanent Mount Using fstab

From your terminal:

sudo gedit /etc/fstab

Add the following lines


vader.mydomain.net:/home/shares/music   /home/carl/music   nfs    rsize=8192,wsize=8192,timeo=14,intr
vader.mydomain.net:/home/shares/client_files   /home/carl/client_files   nfs    rsize=8192,wsize=8192,timeo=14,intr


Save the file

If you reboot the shares will be mounted automatically

To mount without a reboot type:

sudo mount /home/carl/music
sudo mount /home/carl/client_files


NFS Mount via autofs

Autofs uses the automount daemon to manage your mount points by only mounting them dynamically when they are accessed.

(Coming Soon)

Personal tools