Pages

Friday, April 3, 2015

Implementing autofs

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

# vi /etc/exportfs
/local/music    192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)
/local/movie    192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)


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 192.168.1.22 is the IP of the NFS server):

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


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
...
192.168.1.22:/local/music on /export/music type nfs (rw,soft,intr,rsize=8192,wsize=8192,addr=192.168.1.22)
....

No comments:

Post a Comment