- AutoFS is a file system mechanism that provides automatic mounting using
the NFS protocol.
- AutoFS is a client-side service.
- AutoFS file system is initialized by the /lib/svc/method/svc-autofs script.
How that works?
automount command reads maps, send to kernel module "autofs", kernel updates
automountd to mount the fs.
Three components
- The AutoFS filesystem (kernel module)
- The automountd daemon
- The automount command
Automount maps
- master map (/etc/auto_master)
- direct map (/etc/auto_direcct)
- indirect map (/etc/auto_home)
- special map
/net -hosts
1) Master map
/etc/auto_master
+auto_master ;check the NIS map first for master map
Trigger points maps
--------------------
/net -hosts
/home auto_home
/- auto_direct
^--- maps
|
Trigger point
2) Direct map - auto_direct ;NIS recommend to use this one.
/etc/auto_direct
-------------------
/opt/moreapps
*mount point is in the direct map
3) Indirect map - auto_home
/etc/auto_home
-------------------
mary
joe
*mount point is in the master map /home
OR use this wildcard (host1 is the NFS server hosting all the users' home directories)
*
Trick:
automount trigger point, only one hard link (no . and ..)
autofs monitors trigger points.
# ls -ald /home
#dr-xr-xr-x 1 root root 1 Dec 5 11:08 /home/
#cd /net/instructor1/export/share ;auto mount /net special map
#df -k | grep instructor1
instructor1:/export/share
68336699 66293 67587040 1% /net/instructor1/export/share
Note:
Do not manually mount autofs.
grep autofs /etc/mnttab shows autofs
Updating the Automount Maps
When making changes to the master map or creating a direct map, run the
automount command to make the changes effective.
#automount -t duration remains mounted when not in use -v verbosemode
No need to update when direct map is changed.
Any changes to indirect maps are automatically used by the automountd.
Run automount when Master map or Direct map is changed.
To create direct map on a client.
#vi /etc/auto_master
add
/- auto_direct
#vi /etc/auto_direct
/usr/share/man server1:/usr/share/man
#automount -v ; run automount to update the list of directories
#df -k
#man ls
The plus (+) symbol at the beginning of the +auto_master line in this file
directs the automountd daemon to look at the NIS/NIS+ or LDAP databases before
it reads the rest of the map. If this line is comment out, only the local files
are searched unless the /etc/nsswitch.conf file specifies that NIS/NIS+, or
LDAP should be searched.