您的位置:首页 > 其它

Autofs自动挂载服务

2016-05-24 17:22 302 查看
一.环境准备
Xuegod63.cn 服务端Xuegod64.cn 客户端二.搭建服务
服务端配置:安装NFS 服务:[root@xuegod63 ~]# yum -y install nfs-utils创建共享区域:[root@xuegod63 ~]# mkdir -p /opt/abc123修改配置文件:[root@xuegod63 ~]# vim /etc/exports/opt/abc123 *(rw) #共享区域 所有人读写的权限[root@xuegod63 ~]# service nfs restart关闭 NFS 守护进程: [失败]关闭 NFS mountd: [失败]关闭 NFS quotas: [失败]启动 NFS 服务: [确定]关掉 NFS 配额: [确定]启动 NFS mountd: [确定]启动 NFS 守护进程: [确定]正在启动 RPC idmapd: [确定]客户端配置:autofs软件包要实现自动挂载涉及到两个文件,auto.master和auto.misc安装autofs,默认已经安装[root@xuegod64 ~]# yum -yinstall autofs/etc/auto.master 文件定义本地挂载点./etc/auto.misc 配置文件是用来设置需要挂载的文件系统类型和选项创建挂载点:[root@xuegod64 ~]# mkdir /tmp/abc修改配置文件[root@xuegod64 ~]# vim /etc/auto.master/tmp/abc /etc/auto.nfs --timeout=60 #挂载点 超过设置超过60S断开测试服务端是否可以挂载[root@xuegod64 ~]#showmount -e 172.16.30.39Export list for 172.16.30.39:/opt/abc123 *修改配置文件[root@xuegod64 nfs]# vim /etc/auto.nfs #文件可以自定义这里我使用的是auto.nfs
nfs -fstype=nfs 172.16.30.39:/opt/abc123 #指定文件类型 目标地址:opt/abc123目标目录
[root@xuegod64 ~]# service autofs restart #重启autofs服务三.登录测试:
[root@xuegod64 tmp]# cd /tmp/abc/nfs #必须要登录到nfs 这个文件夹才能进行自动挂载。[root@xuegod64 nfs]# df -h Filesystem Size Used Avail Use% Mounted on/dev/vda2 26G 4.0G 21G 17% /tmpfs 940M 72K 940M 1% /dev/shm/dev/vda1 194M 34M 151M 19% /boot172.16.30.39:/opt/abc123 36G 6.8G 27G 21% /tmp/abc/nfs四. 错误篇:1. 如:[root@xuegod64 ~]# showmount -e 172.16.30.39clnt_create: RPC: Port mapperfailure - Unable to receive: errno 113 (No route to host) NFS #端口映射失败――不能接受:errno 113(没有通往主机)解决方法: 服务端 防火墙没有关闭 [root@xuegod63 ~]# service iptables stopiptables:将链设置为政策 ACCEPT:filter [确定]iptables:清除防火墙规则: [确定]iptables:正在卸载模块: [确定]2. [root@monitor ~]# showmount -e 172.16.30.39-bash: showmount: command notfound #客户端没有showmount 命令解决方法:安装showmount命令[root@monitor ~]# yum -y install showmount3. 如果没有自动生成没有有nfs目录,建议:重新卸载nfs autofs 重新安装,客户端配置完以后要重启autofs服务。

本文出自 “天真无邪” 博客,请务必保留此出处http://innocence.blog.51cto.com/4313888/1782600
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: