文件系统挂载可用手动挂载、自动挂载、触发挂载
手动挂载:mount 设备名 挂载点
例如:[root@localhost ~]# mount /dev/sdb1 /home/
卸载: umount 设备名/挂载点
例如:[root@localhost ~]# umount /dev/sdb1
自动挂载:将信息写入/etc/fstab中,可实现开机自动挂载
例如:[root@localhost ~]# vim /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP-sda3 swap swap defaults 0 0
/dev/sdb1 /home ext3 defaults 0 0
设备文件 挂载点 文件系统类型 挂载参数 备份标记 检测顺序
设备文件也可用卷标或UUID替代
触发挂载:依赖于autofs服务,需要访问挂载点时,自动挂载预先指定的设备,无访问时则自动卸载
确认autofs服务已安装并启动
[root@localhost ~]# rpm -q autofs
autofs-5.0.1-0.rc2.177.el5
[root@localhost ~]# service autofs status
automount (pid 3804) 正在运行...
配置主配置文件
[root@localhost ~]# vim /etc/auto.master
#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# 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 (格式:挂载点父目录 挂载配置文件)
#
# 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
配置挂载配置文件,此文件名可自定义,但必须与/etc/auto.master中一致
[root@localhost ~]# vim /etc/auto.misc
cd -fstype=iso9660 :/dev/cdrom
挂载点子目录 挂载参数 :设备名
重启服务
[root@localhost ~]#service autofs restart