码迷,mamicode.com
首页 > 其他好文 > 详细

关于NFS客户端挂载成功但不显示NFS服务端挂载目录下的文件的处理办法及问题还原。

时间:2016-07-05 10:31:14      阅读:6247      评论:0      收藏:0      [点我收藏+]

标签:nfs   挂载   不显示   

一、问题原因

1、1NFS客户端某个目录虽然挂载成功NFS服务端的目录,但是NFS客户端挂载目录里并不显示NFS服务端目录下的内容。

1、2NFS客户端某个目录虽然卸载成功NFS服务端的目录,但是NFS客户端挂载目录里依然显示NFS服务端目录下的内容。


二、问题结论

在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!


三、问题展现

3、1测试服务器基本配置

#提供一台NFS客户端,一台NFS服务端。下述不提供NFS安装教程。

#两台机器共同配置为:

[root@web01 ~]# cat /etc/redhat-release 

CentOS release 6.7 (Final)

[root@web01 ~]# uname -r

2.6.32-573.el6.x86_64

[root@web01 ~]# uname -m

x86_64

#NFS客户端基本配置为:

[root@web01 ~]# ifconfig eth0|awk -F ‘[ :]+‘ ‘NR==2{print $4}‘

10.0.0.8

[root@web01 uploads]# /etc/init.d/iptables status

iptables: Firewall is not running.

[root@web01 uploads]# /etc/init.d/nfs status    #注意NFS客户端不开NFS服务 

rpc.svcgssd is stopped

rpc.mountd is stopped

nfsd is stopped

rpc.rquotad is stopped

[root@web01 uploads]# /etc/init.d/rpcbind status

rpcbind (pid  22918) is running...

[root@web01 ~]# id nginx

uid=502(nginx) gid=502(nginx) groups=502(nginx)


#NFS服务端基本配置为:

[root@nfs01 /]# ifconfig eth0|awk -F ‘[ :]+‘ ‘NR==2{print $4}‘

10.0.0.31

[root@nfs01 /]# /etc/init.d/iptables status

iptables: Firewall is not running.

[root@nfs01 /]# /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...

[root@nfs01 /]# /etc/init.d/rpcbind status

rpcbind (pid  2841) is running...

[root@nfs01 /]# cat /etc/exports 

/data 10.0.0.0/24(rw,sync,anonuid=502,anongid=502,all_squash)#以普通用户nginx挂载

[root@nfs01 /]# id nginx

uid=502(nginx) gid=502(nginx) groups=502(nginx)

[root@nfs01 /]# ls -ld /data/#被挂载目录

drwxr-xr-x. 3 nginx nginx 172032 Jul  5 01:48 /data/


3、2问题还原

#NFS服务端方面:

[root@nfs01 data]# pwd

/data#被挂载目录

[root@nfs01 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客户端方面:

[root@web01 uploads]# pwd

/application/nginx/html/blog/wp-content/uploads#要挂载的目录

[root@web01 uploads]# ll

total 0

[root@web01 /]# 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


#第一种挂载情况

[root@web01 /]# mount -t nfs 10.0.0.31:/data /application/nginx/html/blog/wp-content/uploads

[root@web01 /]# 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

#查看目录内容

[root@web01 uploads]# pwd

/application/nginx/html/blog/wp-content/uploads

[root@web01 uploads]# ll

total 0

#退出去重新进

[root@web01 uploads]# cd ..

[root@web01 wp-content]# cd uploads/

[root@web01 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


#第二种卸掉挂载目录情况

#不退出这个目录

[root@web01 uploads]# pwd

/application/nginx/html/blog/wp-content/uploads

[root@web01 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

#执行卸载操作

[root@web01 /]# umount -lf /application/nginx-1.6.3/html/blog/wp-content/uploads

[root@web01 /]# 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

#再次查看目录内容

[root@web01 uploads]# pwd

/application/nginx/html/blog/wp-content/uploads

[root@web01 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

[root@web01 uploads]# cd ..

[root@web01 wp-content]# cd uploads

[root@web01 uploads]# ll

total 0


四、总结

   一定要注意,在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!

    一定要注意,在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!

    一定要注意,在NFS客户端挂载/卸载NFS服务端目录的时候一定要事先退出挂载目录!挂载/卸载目录之后,再进入挂载目录查看结果!



本文出自 “你可以选择不平凡” 博客,请务必保留此出处http://ylcodes01.blog.51cto.com/5607366/1795781

关于NFS客户端挂载成功但不显示NFS服务端挂载目录下的文件的处理办法及问题还原。

标签:nfs   挂载   不显示   

原文地址:http://ylcodes01.blog.51cto.com/5607366/1795781

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!