Friday, April 3, 2015

Implementing autofs

On the NFS server create your shares by editing the /etc/exports file:

# vi /etc/exportfs

Then (re-)start your NFS services on the server:

# /etc/rc.d/rc.nfs restart

Next edit the /etc/auto.master and add a line for the /export entry:

# vi /etc/auto.master
/misc /etc/auto.misc
/export /etc/auto.export

And create /etc/auto.export file with the music and movie entries (where is the IP of the NFS server):

# vi /etc/auto.export
music   -rw,soft,intr,rsize=8192,wsize=8192
movie   -rw,soft,intr,rsize=8192,wsize=8192

Finally create the /export directory (without any sub directories) and start rc.autofs:

# mkdir /export
# chmod 755 /etc/rc.d/rc.autofs
# /etc/rc.d/rc.autofs start

As a user you can change into eg. /export/music which gets mounted automatically now:

$ cd /export/music
$ ls

$ mount
... on /export/music type nfs (rw,soft,intr,rsize=8192,wsize=8192,addr=