今天我们来学习下自动挂载,当检测到用户访问一个尚未挂载的文件系统时将自动进行动态挂载,从而节约了网络资源和服务器的硬件资源。
yum install autofs -y
vim /etc/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
/mnt /etc/auto.cdrom #新增加的挂载条目
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
vim /etc/auto.cdrom
#挂载目录:cdrom 文件类型:iso9660 ,权限:只读,
cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/sr0
service autofs restart
原文地址:http://blog.51cto.com/10316297/2116195