Tuesday, August 12, 2008

Automounting Home Directories from a Centralized NFS server

In previous posts we configured NFS , client and server. Discussed auto mounting NFS shares and centralized user management . whats left to do is to centralize our users home directories. This makes backups easier to carry out as all users data is kept in one place. It also means that our users can login from any machine on the network and they will have immediate access to all of their files. which is pretty cool.

Right, so NFS server is setup and running on your Server, you must export the /home folder on your NFS server by adding it to your /etc/exports file and then type exportfs -a
NIS should also be configured and running on the same server as described in my previous post.

On the clients computer you need to edit your /etc/auto.master file and add the following entry

/home /etc/auto.home

then create a file called /etc/auto.home and put the following line in your new /etc/auto.home file

* -rw,nosuid,soft servername:/home/&

were servername is the name or ip address of your nfs/nis server

This entry in your /etc/auto.home file will insure that any directory a user tries to access under their own local /home directory (due to the"*" character) will cause an NFS mount on the server within its exported /home filesystem.
you could also add the following mount options to further improve matters

rsize=8192,wsize=8192 which would speed up NFS communication for reads (rsize) and writes (wsize) by setting a larger data block size, to be transferred at one time. do not set this option on older Linux kernels with older network cards as some network cards do not work well with the larger block sizes .
to add this option the file would look like so.


* -rw,nosuid,soft,rsize=8192,wsize=8192 servername:/home/&

The ampersand (&) takes the value of the user name in each line.

Done, your users home directories are now all centralized on your /nfs/nis server

No comments: