Autofs: Difference between revisions

From OLPC
Jump to navigation Jump to search
(Use autofs to seamlessly mount nfs shares on the fly)
No edit summary
Line 10: Line 10:
Next install nfs-utils:
Next install nfs-utils:
yum install nfs-utils
yum install nfs-utils




Now install autofs:
Now install autofs:


yum install autofs
yum install autofs




Configure autofs by editimg /etc/auto.master:
Configure autofs by editing /etc/auto.master:
#
#
Line 41: Line 41:
#
#
#+auto.master
#+auto.master

Notice the line from my auto.master above. I am telling autofs that I want to mount some shares starting in my /media folder. Then I am instructing autofs to look in the file: /etc/auto.media for direction on what and how to do mounting. See my example of /etc/auto.media (Note: replace the Xs to match your servers ip address) :

Pictures -rw,hard 192.xxx.xxx.xxx:/media/Pictures

Now restart autofs:

/etc/init.d/autofs -restart

Now when I "cd /media/Pictures" autofs automagically does nfs mounting behind the scene and I seamlessly now have access to all my pics on my server as if they exist on my xo!

You can augment your auto.media file with other mounts like this:
Pictures -rw,hard 192.xxx.xxx.xxx:/media/Pictures
Music -rw,hard 192.xxx.xxx.xxx:/media/Music

Revision as of 03:53, 15 February 2008

autofs will allow you to easily mount nfs/smb shares

Suppose you have a server on your network that has content you would like to access from your xo. You can setup your xo to mount that share as if it were local to your xo.

First become root user:

su -l

Next install nfs-utils:

yum install nfs-utils


Now install autofs:

yum install autofs


Configure autofs by editing /etc/auto.master:

#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc  /etc/auto.misc
#/net   -hosts
/media /etc/auto.media --timeout=60 
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#+auto.master

Notice the line from my auto.master above. I am telling autofs that I want to mount some shares starting in my /media folder. Then I am instructing autofs to look in the file: /etc/auto.media for direction on what and how to do mounting. See my example of /etc/auto.media (Note: replace the Xs to match your servers ip address) :

Pictures  -rw,hard 192.xxx.xxx.xxx:/media/Pictures

Now restart autofs:

/etc/init.d/autofs -restart

Now when I "cd /media/Pictures" autofs automagically does nfs mounting behind the scene and I seamlessly now have access to all my pics on my server as if they exist on my xo!

You can augment your auto.media file with other mounts like this:

Pictures  -rw,hard 192.xxx.xxx.xxx:/media/Pictures
Music  -rw,hard 192.xxx.xxx.xxx:/media/Music