红联Linux门户
Linux帮助

linux nfs文件挂载模拟云存储

发布时间:2015-12-18 09:46:27来源:linux网站作者:coder_xia

背景

产品上线前兼容性测试,云存储未到位;

系统:SUSE Linux Enterprise Server 11 SP1


解决方法
其中一个服务器A开放nfs服务,模拟云存储,其它服务器挂载A的目录,模拟实现同一存储。


实施
前提,需要有portmap和nfs-utils

rmc01:/root # rpm -qa |grep portmap 
portmap-5beta-749.15 
rmc01:/root # rpm -qa |grep nfs-utils 
nfs-utils-1.0.7-36.29 

发现已安装,启动并检查状态

rmc01:/etc/init.d # ./nfsserver start 
Starting kernel based NFS server                                      done 
rmc01:/etc/init.d # service nfsserver status 
Checking for kernel based NFS server:                                 running 
rmc01:/etc/init.d # service portmap  status 
Checking for RPC portmap daemon:                                      running 

需要注意,在SUSE上,服务名为nfsserver,不是nfs

rmc01:/etc/init.d # service nfs status 
Checking for mounted nfs shares (from /etc/fstab):                    unus 

编辑/etc/exports时注意加上sync选项,如下:

/home/xia/share 10.*.*.*(rw,no_root_squash,<strong>sync</strong>) 

不然会有警告

rmc01:/home/xia/share # /etc/init.d/nfsserver restart 
Shutting down kernel based NFS server                                 done 
Starting kernel based NFS serverexportfs: /etc/exports [6]: No 'sync' or 'async' option specified for export "10.*.*.*:/home/xia/share". 
Assuming default behaviour ('sync'). 
NOTE: this default has changed from previous versions  done 

然后就是重启nfsserver服务和挂载。


CentOS 6.3搭建个人私有云存储ownCloud:http://www.linuxdiyf.com/linux/10771.html