linux下NFS远程目录挂载 |
您所在的位置:网站首页 › 查看nfs挂载 › linux下NFS远程目录挂载 |
NFS 是Network File System的缩写,中文意思是网络文件系统。它的主要功能是通过网络(一般是局域网)让不同的主机系统之间可以共享文件或目录。NFS客户端(一般为应用服务器,例如web)可以通过挂载(mount)的方式将NFS服务器端共享的数据目录挂载到NFS客户端本地系统中(就是某一个挂载点下)。从客户端本地看,NFS服务器端共享的目录就好像是客户端自己的磁盘分区或者目录一样,而实际上却是远端的NFS服务器的目录。 一、服务端 1、检查nfs服务 rpm -qa|grep nfs rpm -qa|grep rpcbind2、安装nfs yum -y install nfs-utils rpcbind3、设置开机自动启动服务 chkconfig nfs on chkconfig rpcbind on4、启动服务 service rpcbind start service nfs start5、创建共享目录 mkdir /data/nfs-share chmod -R 777 /data/nfs-share6、配置exports文件 vi /etc/exports 加入: /data/nfs-share 192.168.1.1(rw)7、刷新配置立即生效 exportfs -a8、查看mount目录 #此时可用showmount -e 服务端ip来查看可mount目录 showmount -e 192.168.1.1
二、客户端 1、创建共享目录 mkdir /data/share-file2、挂载目录 mount 192.168.1.1:/data/nfs-share /data/share-file #若挂载失败,错误提示如下: mount: wrong fs type, bad option, bad superblock on 192.168.1.1:/xxx/xxx, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program) In some cases useful info is found in syslog - try dmesg | tail or so#安装 nfs-utils 即可 yum install nfs-utils 3、卸载已挂载目录 umount /data/share-file4、NFS挂载时出现"access denied by server while mounting"的解决方法 1、使用了非法端口,也就是使用了大于1024的端口。 这个错误,可以通过查看日志确认: [root@local~ /]# cat /var/log/messages | grep mount Jan 2 12:49:04 localhost mountd[1644]: refused mount request from 192.168.1.1 for /data/nfs-share/ (/data/nfs-share): illegal port 1689 解决办法: 修改配置文件/etc/exports,加入 insecure 选项,重启nfs服务,再尝试挂载。 /data/nfs-share/ *(insecure,rw,async,no_root_squash) 2、NFS版本问题 编辑/etc/sysconfig/nfs文件,找到下面: #Turn off v2 and v3 protocol support #RPCNFSDARGS="-N 2 -N 3" #Turn off v4 protocol support #RPCNFSDARGS="-N 4" /*把这句前面的#号去掉*/ 最后保存,重启nfs服务,再尝试挂载;如果挂载不上,可尝试在后面加-o nolock参数。 3、查看客户端挂载的目录是否具备读写权限,添加相应权限即可。 4、nfs服务器上的/etc/hosts中设置了客户端机器IP对应域名,去掉即可。
世间万物 花是花,草是草,你是你,我是我 只要拥有这样的自由,满心才是欢喜 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |