我的NFS服务器在/ etc / exports中共享@H_502_3@
/home/unixmen/ 10.0.0.0/24 (rw,sync,no_root_squash)
在另一台CentOS 6.5主机上运行的客户端能够正常挂载..@H_502_3@
当我尝试使用autofs自动挂载时,没有任何作用,谷歌搜索此问题以找出根本原因,但不成功.@H_502_3@
请参阅autofs配置@H_502_3@
~]$cat /etc/auto.master #/net -hosts #+auto.master /misc /etc/auto.misc
和@H_502_3@
~]$cat /etc/auto.misc unixmen -fstype=nfs 10.0.0.14:/home/unixmen
我确实在/ etc / sysconfig / autofs中更改了日志级别以进行调试,重新启动autofs
和日志说@H_502_3@
Jun 27 17:20:00 ganeshh automount[12322]: mounted indirect on /misc with timeout 300,freq 75 seconds
不确定这是否与mount问题有关@H_502_3@
最近,我在日志中得到了这些数据@H_502_3@
Jun 27 18:11:49 ganeshh automount[12322]: expire_proc: exp_proc = 3063937904 path /misc Jun 27 18:11:49 ganeshh automount[12322]: expire_cleanup: got thid 3063937904 path /misc stat 0 Jun 27 18:11:49 ganeshh automount[12322]: expire_cleanup: sigchld: exp 3063937904 finished,switching from 2 to 1 Jun 27 18:11:49 ganeshh automount[12322]: st_ready: st_ready(): state = 2 path /misc
解决方法
/mnt /etc/auto.master.d/mnt
和相应的地图@H_502_3@
# cat /etc/auto.master.d/mnt helvellyn -ro,soft,intr 10.18.145.31:/var/log/httpd bowfell -ro,intr 10.18.145.27:/var/log/httpd
# ls -al /mnt total 4 drwxr-xr-x 2 root root 0 Jun 14 10:01 . dr-xr-xr-x 25 root root 4096 Jun 27 03:37 ..
注意a)目录是空的,并且b)大小是0字节.前者让你困惑,后者是非法的:即使是空目录也有4096字节的大小.但零是知道automount正确读取你的地图并拥有目录的简便方法.你也可以用df来检查:@H_502_3@
# df -k /mnt Filesystem 1K-blocks Used Available Use% Mounted on /etc/auto.master.d/mnt 0 0 0 - /mnt
现在让我们列出目标目录,即使父显然是空的:@H_502_3@
# ls -al /mnt/helvellyn total 761548 drwxr-xr-x 2 root root 4096 Jun 23 13:21 . drwxr-xr-x 3 root root 0 Jun 27 07:31 .. -rw-r--r-- 1 root root 0 Jun 1 03:18 access_log -rw-r--r-- 1 root root 7485078 May 11 03:09 access_log-20140511 -rw-r--r-- 1 root root 7052254 May 18 03:06 access_log-20140518 -rw-r--r-- 1 root root 5357900 May 25 03:28 access_log-20140525 -rw-r--r-- 1 root root 577579 May 25 16:36 access_log-20140601 [...]
# ls -al /mnt total 8 drwxr-xr-x 3 root root 0 Jun 27 07:31 . dr-xr-xr-x 25 root root 4096 Jun 27 03:37 .. drwxr-xr-x 2 root root 4096 Jun 23 13:21 helvellyn
Automount确实可以进行需求驱动的安装(和卸载).由于/ mnt / helvellyn在您尝试访问它之前不会挂载,因此在第一次访问触发挂载之前无法看到它.@H_502_3@
我希望你能原谅我补充一点,如果你从这个答案中汲取另一个教训,那么细节在UNIX系统管理员中至关重要.如果一条指令要求你做X,那么完全做X可能很重要,而不是你认为完全等同于X的东西.那个小的零大小的目录应该给你一些指示,表明有时候信息很少让你知道某些东西,特别是旧的UNIX东西,正常工作.如果通过不精确的方式,你滑过那些微小的标志,UNIX将不会给你任何其他东西继续,并可能导致混乱.@H_502_3@