Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2264080
  • 博文数量: 168
  • 博客积分: 6641
  • 博客等级: 准将
  • 技术积分: 1996
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-02 11:49
文章存档

2020年(4)

2019年(6)

2017年(1)

2016年(3)

2015年(3)

2014年(8)

2013年(2)

2012年(12)

2011年(19)

2010年(10)

2009年(3)

2008年(17)

2007年(80)

分类: LINUX

2011-06-25 00:24:08


通过autofs自动挂载NFS文件系统

2011-06-24  TsengYia#126.com http://selinux.cublog.cn/

#################################################################

系统环境:
    RHEL 6.0 [2.6.32-71.el6.i686]
软件环境:
    rpcbind-0.2.0-8.el6.i686
    nfs-utils-1.2.2-7.el6.i686
    autofs-5.0.5-23.el6.i686

#################################################################

一、NFS服务器端

[root@localhost ~]# vi /etc/exports
/home    192.168.4.0/24(rw)

[root@localhost ~]# service rpcbind start
[root@localhost ~]# service nfs start

[root@localhost ~]# chkconfig rpcbind on
[root@localhost ~]# chkconfig nfs on

二、NFS客户端(autofs、automount)

[root@localhost ~]# vi /etc/auto.master
…… //省略其他内容
/opt/home    /etc/auto.home

[root@localhost ~]# vi /etc/auto.home
*           -rw,soft,intr    192.168.4.11:/home/&            #//所有子目录
#或者
tsengyia    -rw,soft,intr    192.168.4.11:/home/tsengyia     #//单个子目录

[root@localhost ~]# service rpcbind start
[root@localhost ~]# service autofs start

[root@localhost ~]# chkconfig rpcbind on
[root@localhost ~]# chkconfig autofs on

[root@localhost ~]# ls /opt/home/tsengyia        #//使用时自动挂载
公共的 模板 视频 图片 文档 下载 音乐 桌面

[root@localhost ~]# service autofs stop
[root@localhost ~]# ls /opt/home/tsengyia        #//服务停止,或闲置300秒后自动卸载
ls: 无法访问/opt/home/tsengyia: 没有那个文件或目录

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