AutoFS
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.
Contents |
Installation
Kernel
You need to activate the following kernel options:
File systems --->
<*> Kernel automounter version 4 support (also supports v3)
Software
Install net-fs/autofs:
| USE flag | Default | Recommended | Description |
|---|---|---|---|
| hesiod | No | Install hesiod module | |
| ldap | No | Install LDAP module | |
| sasl | No | Enable SASL support in the LDAP module |
root # emerge --ask autofsConfiguration
Service
Start and add AutoFS to the default runlevel:
root # /etc/init.d/autofs start
root # rc-update add autofs defaultFiles
The configuration files are located in:
- /etc/conf.d/autofs
- /etc/autofs/auto.master
- /etc/autofs/auto.misc
Usage
General configuration files for AutoFS.
autofs configuration
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" #
auto.master
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
auto.misc
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"