关于NFS客户端挂载成功但不显示NFS服务端挂载目录下的文件的处理办法及问题还原。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于NFS客户端挂载成功但不显示NFS服务端挂载目录下的文件的处理办法及问题还原。相关的知识,希望对你有一定的参考价值。
一、问题原因
1、1NFS客户端某个目录虽然挂载成功NFS服务端的目录,但是NFS客户端挂载目录里并不显示NFS服务端目录下的内容。
1、2NFS客户端某个目录虽然卸载成功NFS服务端的目录,但是NFS客户端挂载目录里依然显示NFS服务端目录下的内容。
二、问题结论
在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!
三、问题展现
3、1测试服务器基本配置
#提供一台NFS客户端,一台NFS服务端。下述不提供NFS安装教程。
#两台机器共同配置为:
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[[email protected] ~]# uname -r
2.6.32-573.el6.x86_64
[[email protected] ~]# uname -m
x86_64
#NFS客户端基本配置为:
[[email protected] ~]# ifconfig eth0|awk -F ‘[ :]+‘ ‘NR==2{print $4}‘
10.0.0.8
[[email protected] uploads]# /etc/init.d/iptables status
iptables: Firewall is not running.
[[email protected] uploads]# /etc/init.d/nfs status #注意NFS客户端不开NFS服务
rpc.svcgssd is stopped
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
[[email protected] uploads]# /etc/init.d/rpcbind status
rpcbind (pid 22918) is running...
[[email protected] ~]# id nginx
uid=502(nginx) gid=502(nginx) groups=502(nginx)
#NFS服务端基本配置为:
[[email protected] /]# ifconfig eth0|awk -F ‘[ :]+‘ ‘NR==2{print $4}‘
10.0.0.31
[[email protected] /]# /etc/init.d/iptables status
iptables: Firewall is not running.
[[email protected] /]# /etc/init.d/nfs status
rpc.svcgssd is stopped
rpc.mountd (pid 2963) is running...
nfsd (pid 2979 2978 2977 2976 2975 2974 2973 2972) is running...
rpc.rquotad (pid 2958) is running...
[[email protected] /]# /etc/init.d/rpcbind status
rpcbind (pid 2841) is running...
[[email protected] /]# cat /etc/exports
/data 10.0.0.0/24(rw,sync,anonuid=502,anongid=502,all_squash)#以普通用户nginx挂载
[[email protected] /]# id nginx
uid=502(nginx) gid=502(nginx) groups=502(nginx)
[[email protected] /]# ls -ld /data/#被挂载目录
drwxr-xr-x. 3 nginx nginx 172032 Jul 5 01:48 /data/
3、2问题还原
#NFS服务端方面:
[[email protected] data]# pwd
/data#被挂载目录
[[email protected] data]# ll
total 0
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:37 2
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:43 3
-rw-r--r-- 1 nginx nginx 0 Jul 5 00:51 4
#NFS客户端方面:
[[email protected] uploads]# pwd
/application/nginx/html/blog/wp-content/uploads#要挂载的目录
[[email protected] uploads]# ll
total 0
[[email protected] /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 8.8G 3.0G 5.5G 35% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
#第一种挂载情况
[[email protected] /]# mount -t nfs 10.0.0.31:/data /application/nginx/html/blog/wp-content/uploads
[[email protected] /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 8.8G 3.0G 5.5G 35% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
10.0.0.31:/data 8.8G 1.5G 7.0G 18% /application/nginx-1.6.3/html/blog/wp-content/uploads
#查看目录内容
[[email protected] uploads]# pwd
/application/nginx/html/blog/wp-content/uploads
[[email protected] uploads]# ll
total 0
#退出去重新进
[[email protected] uploads]# cd ..
[[email protected] wp-content]# cd uploads/
[[email protected] uploads]# ll#展现NFS服务端/data目录的文件内容。
total 0
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:37 2
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:43 3
-rw-r--r-- 1 nginx nginx 0 Jul 5 00:51 4
#第二种卸掉挂载目录情况
#不退出这个目录
[[email protected] uploads]# pwd
/application/nginx/html/blog/wp-content/uploads
[[email protected] uploads]# ll
total 0
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:37 2
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:43 3
-rw-r--r-- 1 nginx nginx 0 Jul 5 00:51 4
#执行卸载操作
[[email protected] /]# umount -lf /application/nginx-1.6.3/html/blog/wp-content/uploads
[[email protected] /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 8.8G 3.0G 5.5G 35% /
tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
#再次查看目录内容
[[email protected] uploads]# pwd
/application/nginx/html/blog/wp-content/uploads
[[email protected] uploads]# ll#此时不应该有的,要退出去重新进!
total 0
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:37 2
-rw-r--r-- 1 nginx nginx 0 Jul 4 23:43 3
-rw-r--r-- 1 nginx nginx 0 Jul 5 00:51 4
[[email protected] uploads]# cd ..
[[email protected] wp-content]# cd uploads
[[email protected] uploads]# ll
total 0
四、总结
一定要注意,在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!
一定要注意,在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!
一定要注意,在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!
本文出自 “你可以选择不平凡” 博客,请务必保留此出处http://ylcodes01.blog.51cto.com/5607366/1795781
以上是关于关于NFS客户端挂载成功但不显示NFS服务端挂载目录下的文件的处理办法及问题还原。的主要内容,如果未能解决你的问题,请参考以下文章