Autofs

From OLPC
Jump to: navigation, search

autofs will allow you to easily mount nfs or 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 uncommented 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

MISC

Make sure that the permissions on your auto.* files are such that it they are not executable. Otherwise it won't properly mount.

-rw-r--r-- 1 root root  600 2008-02-12 22:31 auto.master
-rw-r--r-- 1 root root  270 2008-02-12 21:39 auto.media