sontek ( John M. Anderson )

October 30, 2007

AutoFS - Automount network shares

Filed under: Linux, SUSE — Tags: , , , — sontek @ 12:32 am

Using AutoFS you can have all your network shares automatically mounted (CIFS, SMB, NFS, NIS) rather than defining every share in your /etc/fstab. To do this you just need to setup your /etc/auto.master (this is where it is on SUSE, it can be in a different file on other distros, check /etc/sysconfig/autofs for MASTER_MAP_NAME if its not there) with these lines:

 +auto.master
/net -hosts
/cifs /etc/auto.smb

the /net -hosts part says “mount all NFS shares on the network inside the /net folder”, -hosts is built into AutoFS and will scan your network for NFS shares.  The /cifs /etc/auto.smb says “mount all CIFS shares on the network in /cifs”, auto.smb is an external file AutoFS will read to figure out how to mount the CIFS shares.

So with this configuration you will now have the ability to just change into an nfs/cifs share as if it is already mount, like cd /net/fileserver/music or even list files in the share with ls /cifs/fileserver2/ebooks and it will auto mount the shares as you need them.  If you don’t use the shares for a certain amount of time (you can check /etc/sysconfig/autofs for DEFAULT_TIMEOUT to get the exact time), which allows you to roam network to network aimlessly always getting the shares on that network.

For more information check out the man pages for autofs, automount, and auto.master.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • description
  • Pownce
  • Slashdot
  • StumbleUpon
  • TwitThis

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress