#################################################################### Searchable Keywords: automounter autofs auto Autofs is alot like the fstab or vfstab or Solaris automounter. It will use files, nis or programs to map data directories. --- After some frustration and reading all this #@#$%^& I discovered the anwser to configuring auotmounter to mount a remote host is the following for autfs version 3.1.4-4. 1) config the remote hosts /etc/exports file 2) create or edit the local /etc/auto.misc or /etc/auto.yourchoice but make sure you have same map from /etc/auto.master Your syntax is........ home -rw,soft pingy.keen.org:/home Home is the example it could be any nfs exported directory -------------- Everything else is just informational ---------------- AutoFS Setup The setup of AutoFS is similar to that of NFS. First, the file /etc/exports must be properly set up. Follow the directions in the NFS section to do this. Next, we must set up the two AutoFS configuration files. The first of these is /etc/auto.master. This file tells us where AutoFS will mount the appropriate directories. For instance, we usually mount all the shared files under /misc, and we will use the file /etc/auto.misc to tell AutoFS which mounts we have. In addition, we choose a minute as the default un-mount time. Thus, our configuration file, /etc/auto.master, would read /misc /etc/auto.misc --timeout 60 Now, we must configure /etc/auto.misc. This is a reasonably straightforward file. It is set up similar to the fstab file, but it has its own syntax. The syntax is: where "location and name" is the same as the fstab equivalent. "Options" are also quite similar to the options given in fstab. A partial listing of the /etc/auto.misc file on cdfpc3 is given below: home -fstype=nfs,rw,soft,intr cdflx0:/home datalx1 -fstype=nfs,rw,soft,intr cdflx1:/datalx1 datalx2 -fstype=nfs,rw,soft,intr cdflx2:/datalx2 Now, all that's left is to ensure that portmap, nfs, and autofs are running: /etc/rc.d/init.d/autofs stop /etc/rc.d/init.d/nfs stop /etc/rc.d/init.d/portmap stop /etc/rc.d/init.d/portmap start /etc/rc.d/init.d/nfs start /etc/rc.d/init.d/autofs start Now, we should symbolically link to the newly set up shares. For instance, because we set up the share cdflx0:/home on the line "home", any time that somebody lists /misc/home it will automatically mount the appropriate NFS share. The reason that it goes to /misc is because that is how auto.master is set up. But since we want to have /home mounted on the root partition, we type the following: ln -s /misc/home /home This will create a link, located at /home, to /misc/home. So, whenever anybody does a directory listing on /home, it will in truth be listing the files at /misc/home. AutoFS Setup autofs One drawback to using /etc/fstab is that, regardless of how much you use that mounted filesystem, your system must dedicate resources to keep that mount in place. This is not a problem with one or two mounts, but when your system is maintaining mounts to a dozen systems at one time, overall system performance can suffer. An alternative to /etc/fstab is to use the kernel-based automount utility, which will mount and unmount NFS filesystems automatically, saving resources. The autofs script, located in /etc/rc.d/init.d, is used to control automount through the /etc/auto.master primary configuration file. While automount can be specified on the command line, it is more convenient to specify the mount points, hostname, exported directory, and options in a set of files rather than typing them all by hand. By running autofs as a service that starts and stops in designated runlevels, the mount configurations in the various files can be automatically implemented. In order to use autofs, you must have the autofs RPM installed on your system. The autofs configuration files are arranged in a parent-child relationship. A main configuration file (/etc/auto.master) refers mount points on your system that are linked to a particular map type, which take the form of other configuration files, programs, NIS maps, and other less common mount methods. The auto.master file contains lines referring to each of these mount points, organized like this: The indicates where the device or exported filesystem should mount on your local filesystem. The relates to the way in which the mount point will be mounted. The most common method for auto mounting NFS exports is to use a file as the map type for the particular mount point. The map file, usually named auto., where is the mount point designated in auto.master, contains lines that look like this: : The refers to the directory within the mount point where the exported filesystem should be mounted. Much like a standard mount command, the host exporting the filesystem, as well as the fil esystem being exported, are required in the : section. To specify particular options to be used when mounting the exported filesystem, place them in the section, separated by commas. For NFS mounts that use autofs, you should definitely place -fstype=nfs in the section, at a minimum. While autofs configuration files can be used for a variety of mounts to many types of devices and filesystems, they are particularly useful in creating NFS mounts. For example, some organizations store a user's /home directory on a central server via an NFS share. Then, they configure the auto.master file on each of the workstations to point to an auto.home file containing the specifics for how to mount the /home directory via NFS. This allows the user to access personal data and configuration files in their /home directory by logging in anywhere on the internal network. The auto.master file in this situation would look similar to this: /home /etc/auto.home This sets up the /home mount point on the local system to be configured by the /etc/auto.home file, which may look similar to this: * -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid server.domain.com:/home/& This line states that any directory a user tries to access under the local /home directory (due to the asterisk character) should result in an NFS mount on the server.domain.com system within its exported /home filesystem. The mount options specify that each /home directory NFS mounts should use a particular collection of settings. For more information on mount options, including the ones used in this example, see the section called Common NFS Mount Options. autofs One drawback to using /etc/fstab is that, regardless of how much you use that mounted filesystem, your system must dedicate resources to keep that mount in place. This is not a problem with one or two mounts, but when your system is maintaining mounts to a dozen systems at one time, overall system performance can suffer. An alternative to /etc/fstab is to use the kernel-based automount utility, which will mount and unmount NFS filesystems automatically, saving resources. The autofs script, located in /etc/rc.d/init.d, is used to control automount through the /etc/auto.master primary configuration file. While automount can be specified on the command line, it is more convenient to specify the mount points, hostname, exported directory, and options in a set of files rather than typing them all by hand. By running autofs as a service that starts and stops in designated runlevels, the mount configurations in the various files can be automatically implemented. In order to use autofs, you must have the autofs RPM installed on your system. The autofs configuration files are arranged in a parent-child relationship. A main configuration file (/etc/auto.master) refers mount points on your system that are linked to a particular map type, which take the form of other configuration files, programs, NIS maps, and other less common mount methods. The auto.master file contains lines referring to each of these mount points, organized like this: The indicates where the device or exported filesystem should mount on your local filesystem. The relates to the way in which the mount point will be mounted. The most common method for auto mounting NFS exports is to use a file as the map type for the particular mount point. The map file, usually named auto., where is the mount point designated in auto.master, contains lines that look like this: : The refers to the directory within the mount point where the exported filesystem should be mounted. Much like a standard mount command, the host exporting the filesystem, as well as the fil esystem being exported, are required in the : section. To specify particular options to be used when mounting the exported filesystem, place them in the section, separated by commas. For NFS mounts that use autofs, you should definitely place -fstype=nfs in the section, at a minimum. While autofs configuration files can be used for a variety of mounts to many types of devices and filesystems, they are particularly useful in creating NFS mounts. For example, some organizations store a user's /home directory on a central server via an NFS share. Then, they configure the auto.master file on each of the workstations to point to an auto.home file containing the specifics for how to mount the /home directory via NFS. This allows the user to access personal data and configuration files in their /home directory by logging in anywhere on the internal network. The auto.master file in this situation would look similar to this: /home /etc/auto.home This sets up the /home mount point on the local system to be configured by the /etc/auto.home file, which may look similar to this: * -fstype=nfs,soft,intr,rsize=8192,wsize=8192,nosuid server.domain.com:/home/& This line states that any directory a user tries to access under the local /home directory (due to the asterisk character) should result in an NFS mount on the server.domain.com system within its exported /home filesystem. The mount options specify that each /home directory NFS mounts should use a particular collection of settings. For more information on mount options, including the ones used in this example, see the section called Common NFS Mount Options. Autofs Files Autofs Automounter Binaries and Config Files The autofs related binaries and files are: /usr/sbin/automount autofs binary /etc/auto.master master file /etc/auto.misc map file /etc/rc.d/init.d/autofs autofs startup script /usr/lib/autofs autofs libraries /lib/modules/Kernel.Version/fs/autofs.o autofs loadable module /.autofs temporary directory to manage the mount points /var/log/messages log files ( depends on your syslog.conf ) Note: Kernel.Version will vary on your system, eg: 2.0.35 for linux-2.0.35 NOTE: Sometimes the autofs startup script is at /etc/rc.d/rc.autofs Autofs Automounter Directory tree /.autofs This is your temporary mount directory, its contents are managed my the automount daemon, autofs. Please do NOT add or delete links, files, sub-directories from this direcotry This top level directory name is defined in /etc/auto.master If the desired top level directory does not exit, please create it. root# mkdir /.autofs /etc/auto.master Autofs files For more info and example, man auto.master This file is read by the autofs startup scripts usually at boot time to determine the mount points of the automounted file system. The autofs script can be stop and started at anytime to reload a new mount point. -- -- autofs does NOT reload nor restart if the mounted directory ( eg: /home ) is busy -- In the example below, /.autofs is the mount point and /etc/auto.misc is the map file defining the options for the mount point. # # Sample /etc/auto.master file # ------ # # see man pages for more info, "man autofs.master" # # To Reload Changes to this file # ------------------------------ # /etc/rc.d/init.d/autofs stop ; /etc/rc.d/init.d/autofs start # # # format of this file: # mountpoint map options # For details of the format, look at autofs(8) # /.autofs /etc/auto.misc --timeout 60 # # end of file /etc/auto.misc Autofs Mount Map File auto.misc is your mount point map file. It defines all your partions you want the automounter to mount and unmount for you and where to mount it onto your filesystem. A brief description of the mount point options used in the example below: -ro read only from the remote host -soft if the remote host is unavailable, return an error and don't retry after the timeout period expired -hard if the remote host is unavailable, retry until it does respond - be careful that hard mounts does NOT causes slow network and hung systems ( use it in conjunction with -intr or be readily available to check ( on the network status -intr allows the keyboard interrupts to kill the process that is hung waiting for the remote host to respond -bg do the retries in background mode -fg do the retries in foreground mode -fstype defines your file system type ext2 for linux native, iso9660 for cdroms, nfs for NFS mounted filesystem Note that the CDROM have a ??? syntax to mount it as needed. Note that kernel is a fully qualified domain name while home, mail uses local host names without the DomainName.com CAUTION: When defining /home directories and partitions, please be aware of /home from your remote server IS being mounted over your local /home directory already on your machine. Typically, people use /home/users for mounting users or /u or /export/home to avoid confusion. When the automounter is properly loaded and running, it will manage some directories in it's temporary mount dirctory /.autofs. # # Sample /etc/auto.misc # ------ # # To Reload Changes to this file # ------------------------------ # /etc/rc.d/init.d/autofs stop ; /etc/rc.d/init.d/autofs start # # To see the Status and log messages # ---------------------------------- # /etc/rc.d/init.d/autofs status # tail -100 /var/log/messages # # kernel -ro,soft,intr ftp.kernel.org:/pub/linux # cdrom -fstype=iso9660,ro :/dev/cdrom # #floppy -fstype=auto :/dev/fd0 floppy -fstype=ext2 :/dev/fd0 # # Define your Home directory ( server ) # CAUTION: /home vs the local /home already on your system home -fstype=nfs home:/home # # hard mounted, keep trying to connect to the Mail server mail -fstype=nfs mail:/var/spool/mail # # # Define some backups disk on a different machine # # soft -- timeout and give up the server is unavailable # Backup_1 -fstype=nfs,soft mach1:/Backup Backup_0 -fstype=nfs,soft mach2:/Backup # # # Try to mount mach1 first, if that fails, try mach2 # Backup -fstype=nfs mach1,mach2:/Backup ??? is it supported ?? # # # To implement "/net -hosts" form from Solaris automounter: # # * -soft,bg,intr &:/ # # # To automount your WinNT box # WinNT_C -fstype=smbfs,login=your_id,passwd=xxxxxx WinNT:/C # # end of file Additional AutoFS Examples Excerpted from autofs mailing list, submitted by Peter Anvin (hpa@transmeta.com) To have autofs automount your remote hosts # # Sample auto.master # ------ # /auto auto.auto # # end of file # # Sample auto.auto # ------ # host1 -fstype=autofs file:/etc/auto.host1 host2 -fstype=autofs file:/etc/auto.host2 host3 -fstype=autofs file:/etc/auto.host3 # # end of file (If you're using something else than file maps, substitute with yp:auto.host1 or whatever.) If you have options for the various host maps, add them after the -fstype argument (e.g. -fstype=autofs,ro) or add them to the entries in the individual host maps (probably preferred, then you can control them per individual mount point, too.) For expires to work properly you need a recent 2.1.x kernel. Autofs Files Autofs Automounter Binaries and Config Files The autofs related binaries and files are: /usr/sbin/automount autofs binary /etc/auto.master master file /etc/auto.misc map file /etc/rc.d/init.d/autofs autofs startup script /usr/lib/autofs autofs libraries /lib/modules/Kernel.Version/fs/autofs.o autofs loadable module /.autofs temporary directory to manage the mount points /var/log/messages log files ( depends on your syslog.conf ) Note: Kernel.Version will vary on your system, eg: 2.0.35 for linux-2.0.35 NOTE: Sometimes the autofs startup script is at /etc/rc.d/rc.autofs Autofs Automounter Directory tree /.autofs This is your temporary mount directory, its contents are managed my the automount daemon, autofs. Please do NOT add or delete links, files, sub-directories from this direcotry This top level directory name is defined in /etc/auto.master If the desired top level directory does not exit, please create it. root# mkdir /.autofs /etc/auto.master Autofs files For more info and example, man auto.master This file is read by the autofs startup scripts usually at boot time to determine the mount points of the automounted file system. The autofs script can be stop and started at anytime to reload a new mount point. -- -- autofs does NOT reload nor restart if the mounted directory ( eg: /home ) is busy -- In the example below, /.autofs is the mount point and /etc/auto.misc is the map file defining the options for the mount point. # # Sample /etc/auto.master file # ------ # # see man pages for more info, "man autofs.master" # # To Reload Changes to this file # ------------------------------ # /etc/rc.d/init.d/autofs stop ; /etc/rc.d/init.d/autofs start # # # format of this file: # mountpoint map options # For details of the format, look at autofs(8) # /.autofs /etc/auto.misc --timeout 60 # # end of file /etc/auto.misc Autofs Mount Map File auto.misc is your mount point map file. It defines all your partions you want the automounter to mount and unmount for you and where to mount it onto your filesystem. A brief description of the mount point options used in the example below: -ro read only from the remote host -soft if the remote host is unavailable, return an error and don't retry after the timeout period expired -hard if the remote host is unavailable, retry until it does respond - be careful that hard mounts does NOT causes slow network and hung systems ( use it in conjunction with -intr or be readily available to check ( on the network status -intr allows the keyboard interrupts to kill the process that is hung waiting for the remote host to respond -bg do the retries in background mode -fg do the retries in foreground mode -fstype defines your file system type ext2 for linux native, iso9660 for cdroms, nfs for NFS mounted filesystem Note that the CDROM have a ??? syntax to mount it as needed. Note that kernel is a fully qualified domain name while home, mail uses local host names without the DomainName.com CAUTION: When defining /home directories and partitions, please be aware of /home from your remote server IS being mounted over your local /home directory already on your machine. Typically, people use /home/users for mounting users or /u or /export/home to avoid confusion. When the automounter is properly loaded and running, it will manage some directories in it's temporary mount dirctory /.autofs. # # Sample /etc/auto.misc # ------ # # To Reload Changes to this file # ------------------------------ # /etc/rc.d/init.d/autofs stop ; /etc/rc.d/init.d/autofs start # # To see the Status and log messages # ---------------------------------- # /etc/rc.d/init.d/autofs status # tail -100 /var/log/messages # # kernel -ro,soft,intr ftp.kernel.org:/pub/linux # cdrom -fstype=iso9660,ro :/dev/cdrom # #floppy -fstype=auto :/dev/fd0 floppy -fstype=ext2 :/dev/fd0 # # Define your Home directory ( server ) # CAUTION: /home vs the local /home already on your system home -fstype=nfs home:/home # # hard mounted, keep trying to connect to the Mail server mail -fstype=nfs mail:/var/spool/mail # # # Define some backups disk on a different machine # # soft -- timeout and give up the server is unavailable # Backup_1 -fstype=nfs,soft mach1:/Backup Backup_0 -fstype=nfs,soft mach2:/Backup # # # Try to mount mach1 first, if that fails, try mach2 # Backup -fstype=nfs mach1,mach2:/Backup ??? is it supported ?? # # # To implement "/net -hosts" form from Solaris automounter: # # * -soft,bg,intr &:/ # # # To automount your WinNT box # WinNT_C -fstype=smbfs,login=your_id,passwd=xxxxxx WinNT:/C # # end of file Additional AutoFS Examples Excerpted from autofs mailing list, submitted by Peter Anvin (hpa@transmeta.com) To have autofs automount your remote hosts # # Sample auto.master # ------ # /auto auto.auto # # end of file # # Sample auto.auto # ------ # host1 -fstype=autofs file:/etc/auto.host1 host2 -fstype=autofs file:/etc/auto.host2 host3 -fstype=autofs file:/etc/auto.host3 # # end of file (If you're using something else than file maps, substitute with yp:auto.host1 or whatever.) If you have options for the various host maps, add them after the -fstype argument (e.g. -fstype=autofs,ro) or add them to the entries in the individual host maps (probably preferred, then you can control them per individual mount point, too.) For expires to work properly you need a recent 2.1.x kernel.