Chinaunix首页 | 论坛 | 博客
  • 博客访问: 492410
  • 博文数量: 138
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 716
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-03 21:48
文章分类

全部博文(138)

文章存档

2019年(1)

2017年(5)

2016年(99)

2015年(33)

我的朋友

分类: LINUX

2016-04-10 14:52:32

autofs 自动挂载.

操作环境:redhat 6


一、autofs 说明

自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的挂载

自动挂载器由autofs服务脚本管理

自动挂载器由auto.master配置文件进行配置,该文件引用了一个按惯例称作/etc/auto.misc


二、安装autofs

[root@Alex01 home]# yum install autofs


三、配置autofs

[root@Alex01 home]# rpm -qc autofs


[root@Alex01 home]# vim /etc/auto.master

/misc是定义的自动mount的挂载点, /etc/auto.misc里定义了mount的动作.

当然里的/misc可以自定义


[root@Alex01 home]# vim /etc/auto.misc

/dev/sde 分区挂载到 /misc/sde_test目录里面去

# 这些/misc/sde目录,都不需要自己去创建,启动autofs时会自动创建,

ps: 

挂载samba的配置: 

# backup      -fstype=cifs,username=smbuser1%asdf     ://192.168.1.99/pub


挂载iso的配置: 

# iso       -loop,fstype=iso9660,ro       :/root/rhel-server-6.0-x86_64-boot.iso


挂载nfs的配置:

nfs        -fstype=nfs            192.168.1.99:/test_nfs


[plain] view plain copy
  1. [root@Alex01 misc]# /etc/init.d/autofs reload             # 重启载入配置文件  
  2.   
  3. [root@Alex01 misc]# ll                                    # 然后在/misc目录里面什么文件也没有,这时,其实已经载入成功,只是文件夹没有显示,  
  4. 总用量 0  
  5.   
  6. [root@Alex01 misc]# cd sde_test                           #  只有手动cd sde_test 进入这个文件夹后,才会在/misc文件夹下面显示  
  7.   
  8. [root@Alex01 misc]# ll  
  9.   
  10. drwxrwxrwx. 2 root root 4096  8月 20 19:45 sde_test       # 现在就有了.  



# 如果上时间不进入,就会自动断开,默认是300秒.

# 在/etc/sysconfig/autofs配置.

阅读(1443) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~