Configuring an NFS auto mount

This guide was created using CentOS 6.
The example configuration consists of SERVER01 and SERVER02.
This guide was written for people who have some basic Linux experience.

Connect to the Linux Server acting as the NFS server SERVER01 using your favorite ssh client.
Then use vi to open the /etc/exports file.

vi /etc/exports

Add the following entry into the /etc/exports file.
This configuration accomplishes the following.
/mnt/volume is exposed to the NFS client SERVER02
The NFS client SERVER02 can read and write to /mnt/volume on
rw = read write access
ro = read only
no_root_squash = persist root access between systems
sync = causes all buffered modifications to file metadata and data to be written to the underlying file systems
Additional information can be found in the nfs man pages

/mnt/volume               SERVER02(rw,sync)

Run the following command on SERVER01 to reread the export file change (/etc/exports)

/usr/sbin/exportfs -ra

ssh into server SERVER02 to setup auto mounting of NFS export on SERVER01
Auto mounting, automatically connects and disconnects from the NFS export whenever it is in use or not in use. In the example below we are connecting to the NFS mount point on SERVER01 using read write.
The directory volume will automatically be created under /mnt on SERVER01 when you connect.

vi /etc/auto.misc
volume           -rw,soft,rsize=8192,wsize=8192,timeo=14,intr SERVER01:/mnt/volume

Use vi to edit the /etc/auto.master file. The master file defines which root directory to auto mount remote file systems on. It functions as a key / value pair. /mnt is the root mount point for file systems defined in /etc/auto.msic with a timeout value of 500 seconds.

vi /etc/auto.master
/mnt    /etc/auto.misc  --timeout 500

Reload the autofs service, so that the new configuration becomes active

service autofs reload

To verify the NFS auto mount point is working.

cd /mnt/volume 

If you run into problems, check the Linux systems log. This is the first place I look when troubleshooting.

tail -n 30 /var/log/messages
Advertisements

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