Click to See Complete Forum and Search --> : autofs


happybunny
06-15-2006, 03:44 PM
the autofs feature is one of the coolest options in linux.

the autofs system will automatically mount filesystems (local or remote) when a user or application tries to access any data in the mount path.

Then, after a set time of idle'ness, autofs will unmount the filesystem freeing up those resources.

After installing autofs using your distro's package manager, simply edit these files:

/etc/auto.master
/mnt/software /etc/auto.misc --timeout=120

the /mnt directory must exist
/mnt/software will be magically created for you, so you should NOT create it.
the /etc/auto.misc entry can actually be any "map" file, but /etc/auto.misc is the default map.
the --timeout value is how long (in seconds) the mount should be idle before it is unmounted.
also note, that if /mnt/software does exist, any current folders or data will be inaccessible while autofs is running.

/etc/auto.misc
linuxsoft -fstype=nfs linuxsoft:/software

linuxsoft is the name of the local mount point where the file system will show up, underneath the path from auto.master.
In this example, /mnt/software/linuxsoft

-fstype is the type of filesystem (ftp, ext3, nfs, etc).

The last column is where the filesystem is, in this example it is a server called linuxsoft and a "share" of software. It is not necesarry that the location and server name be the same as in this example.


I set this up on the linux servers to automatically mount a common network share where all of our config files and software is stored. So from any linux machine, I can access a single repository of data by simply cd'ing into /mnt/software/linuxsoft.

This configuration helps us keep our software versions aligned and to not have local (and out of date) copies of software on each host.

Another feature I configured was to also allow that same share to be accessed via a Samba share to all the Windows machines. This makes it very easy to share files back and forth from linux and Windows.

but I'll leave that for another post!

gehidore
06-15-2006, 06:14 PM
I think I like this, thanks for posting it!