2,再来看客户端:
所以,可以 vi /etc/exports
/data 10.0.0.0/24(rw,sync,all_squash,anonuid=888,anongid=999)
来指定用户的UID和GID,当然服务端需存在UID、GID为888的用户,客户端只要存在UID、GID为888的用户,就可以拥有服务端对共享目录设置权限后的各种权限了。
错误提示解决:
错误提示1:
挂载失败,查看服务端服务是否正常运行
[root@server ~]#/etc/init.d/portmap status
portmap is stopped
[root@server ~]#/etc/init.d/portmap start
Starting portmap: [ OK ]
[root@server ~]#/etc/init.d/nfs status
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
[root@server ~]#/etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@client yubing]# mount -tnfs 10.0.0.152:/data /yubing
[root@client yubing]# df -h
文件系统容量已用可用已用% 挂载点
错误提示2:
[root@server ~]#/etc/init.d/nfs start 启动nfs失败
Starting NFSservices: [ OK ]
Starting NFSquotas: Cannot register service: RPC: Unable to receive; errno = Connectionrefused
rpc.rquotad:unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFSdaemon: [FAILED]
[root@server ~]#/etc/init.d/portmap status
portmap is stopped
[root@server ~]#/etc/init.d/portmap start
Starting portmap: [ OK ]
[root@server ~]#/etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
必须先启动portmap服务后再启动nfs服务,因为NFS及其辅助程序都是基于RPC(Remote Procedure Call)协议的(使用的端口为111),所以首先要确保系统中运行了portmap服务。
错误提示3:
[root@server ~]#/etc/init.d/nfs reload
exportfs: Nooptions for /data10.0.0.0/24(rw,sync) : suggest (sync) to avoid warning
[root@server ~]#/etc/init.d/nfs reload
exportfs: No options for/data10.0.0.0/24(rw,sync) : suggest (sync) to avoid warning
[root@server ~]# vi /etc/exports
/data10.0.0.0/24(rw,sync) 中间没空格
改为:
错误提示4:
[root@client yubing]# df -h
文件系统容量已用可用已用% 挂载点
/dev/sda3 19G 1.6G 16G 9% /
/dev/sda1 122M 12M 104M 10% /boot
tmpfs 506M 0 506M 0% /dev/shm
(卡死,不能做任何操作)
[root@client ~]# cd /yubing
(依然卡死)
客户端挂载了服务端的共享目录,服务端如果关闭,就会出现卡死
只能重新连接后取消挂载
错误提示5
NFS服务端/data/r_shared目录不存在。检查共享目录是/date/r_shared。
就是这些了,有关linux中搭建nfs服务器的方法,介绍完了。希望对大家有所帮助。