AutoFS uses the Linux kernel Automounter to automatically mount several types of media like memory sticks, network shares, CD-Rom/DVD/BR etc. on demand.
You need to activate the following kernel options:
File systems ---> <*> Kernel automounter version 4 support (also supports v3)
|USE flag (what is that?)||Default||Recommended||Description|
||No||Enable debugging with the dmalloc library|
||No||Install hesiod module|
||No||Install LDAP module|
||No||Use libtirpc lib support|
||No||Enable SASL support in the LDAP module|
||No||Enable locking to prevent corruption of /etc/mtab in the presence of concurrent auto-mounting. If enabled, recursive auto-mounting (eg. using autofs to bind or loop mount a filesystem which is itself auto-mounted) is not possible.|
emerge --ask autofs
Start and add AutoFS to the default runlevel:
rc-update add autofs default
The configuration files are located in:
General configuration files for AutoFS.
You probably need to install additional software and modules to mount DVD, NFS, CIFS etc. The mount helpers need to be available for each file system you configure.
The default options for autofs can be changed by setting the proper configuration variables located in /etc/conf.d/autofs; in the following example, the default location for the master map (/etc/auto.master) is changed by setting the MASTER_MAP_NAME configuration variable:
# # Define default options for autofs. # # MASTER_MAP_NAME - map name for the master map; # default is /etc/auto.master # MASTER_MAP_NAME="/etc/autofs/auto.master" #
The following examples of configuration files take into account the new location for auto.master set above.
In this configuration file is defined what other configuration files should be included as root mount-point. Here is one example with one additional mount-point on /mnt/auto:
+auto.master # extry needed for NIS mapping # Here are the files listed, that should be included # mount-point | config file | options /mnt/auto /etc/autofs/auto.misc --timeout=15 --ghost
/mnt/auto is the root mount-point for all file systems defined in auto.misc. --timeout defines how many seconds to wait before the file system is unmounted. --ghost creates empty folders for each mount-point in auto.misc, this prevents timeouts if a network share cannot be contacted.
Here is our example for the file auto.misc. The folders for the mount-points are automatically created
# mount-point below /mnt/auto | mount options | device, network share etc. # CD-Rom on /mnt/auto/cd cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom # nework share mounted via NFSv3 on /mnt/auto/data data -rw,vers=3,soft,async 192.168.0.254:/tank1/data # nework share mounted via CIFS on /mnt/auto/data1 data1 -fstype=cifs,credentials=/root/smb.txt ://192.168.0.254/data1 # memory stick used regulary with known UUID, for example a kindle kindle -fstype=vfat,rw,uid=1000 :UUID="4CBF-23A2"
There are several more examples in the auto.misc that comes with the package
- Automount mini-Howto on The Linux Documentation Project website