Home > Filesystems > Mounting NFS Resources

Mounting NFS Resources

Last week I published an article about mounting remote filesystems in Linux using the SSHFS method.

Today I’m covering another way of implementing a network filesystem; This method is the classic one and maybe one of the most used out there.

NFS stands for Network File System and the main difference between SSHFS is that NFS by himself is a network protocol, while SSHFS makes use of our favorite terminal access method: SSH.
NFS does NOT send the information through a secure tunnel, hence it is only recommended(and I really mean ONLY) on those situations where you trust your network traffic or have already implemented another way of authenticating the server.

The first step is to check whether or not our server has NFS daemon already installed; NFS is an extension of the mount command. By default, most Linux distributions already include the mount libraries.

# mount.nfs -V

Now, lets start the daemon.

$ /etc/init.d/nfs start

Lets suppose we want the folder /usr/man/ from computer HOST_ONE, to be mounted on /mnt/backup/ on computer HOST_TWO.

What we have to do is connect to HOST_ONE and tell the system which folders are authorized to be shared. This is defined in the exports file:

$ vi /etc/exports/

Probably the file would be empty, so lets start filling it. The asterisk tells the system to grant r,w,x privileges. :

/usr/man    *

Alternally you can add specific privileges enclosed by parentheses.

/usr/man    *(rw)

After saving the changes, restart the FNS daemon:

$ /etc/init.d/nfs start

This is everything we have to do on HOST_ONE. Nos its time to actually mount the filesystem on the remote computer.

$ mount -t nfs 192.168.10.20:/usr/man /mnt/backup

Alternately you can add the IP address of the machine to the /etc/hosts file and use the host name instead of the IP:

$ mount -t nfs HOST_ONE:/usr/man /mnt/backup

Advertisements
Categories: Filesystems Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: