nfs – automount – 在CentOS 6.5上的autofs挂载问题

前端之家收集整理的这篇文章主要介绍了nfs – automount – 在CentOS 6.5上的autofs挂载问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Server CentOS 6.5和Se linux是宽容的

我的NFS服务器在/ etc / exports中共享

  1. /home/unixmen/ 10.0.0.0/24 (rw,sync,no_root_squash)

在另一台CentOS 6.5主机上运行的客户端能够正常挂载..

当我尝试使用autofs自动挂载时,没有任何作用,谷歌搜索此问题以找出根本原因,但不成功.

我想知道我是否正在做一些基本的错误..

请参阅autofs配置

  1. ~]$cat /etc/auto.master
  2. #/net -hosts
  3. #+auto.master
  4. /misc /etc/auto.misc

  1. ~]$cat /etc/auto.misc
  2. unixmen -fstype=nfs 10.0.0.14:/home/unixmen

我确实在/ etc / sysconfig / autofs中更改了日志级别以进行调试,重新启动autofs
和日志说

  1. Jun 27 17:20:00 ganeshh automount[12322]: mounted indirect on /misc with timeout 300,freq 75 seconds

不确定这是否与mount问题有关

最近,我在日志中得到了这些数据

  1. Jun 27 18:11:49 ganeshh automount[12322]: expire_proc: exp_proc = 3063937904 path /misc
  2. Jun 27 18:11:49 ganeshh automount[12322]: expire_cleanup: got thid 3063937904 path /misc stat 0
  3. Jun 27 18:11:49 ganeshh automount[12322]: expire_cleanup: sigchld: exp 3063937904 finished,switching from 2 to 1
  4. Jun 27 18:11:49 ganeshh automount[12322]: st_ready: st_ready(): state = 2 path /misc

最终/ misc目录中没有挂载文件

解决方法

现在我们已经让它工作了(-fstype = nfs不需要,并且可能在地图中无效)你的问题背叛了对automount如何呈现给用户的误解.

这是我的主文件中的automount条目

  1. /mnt /etc/auto.master.d/mnt

和相应的地图

  1. # cat /etc/auto.master.d/mnt
  2. helvellyn -ro,soft,intr 10.18.145.31:/var/log/httpd
  3. bowfell -ro,intr 10.18.145.27:/var/log/httpd

现在这里是触发器目录中的一些ls输出

  1. # ls -al /mnt
  2. total 4
  3. drwxr-xr-x 2 root root 0 Jun 14 10:01 .
  4. dr-xr-xr-x 25 root root 4096 Jun 27 03:37 ..

注意a)目录是空的,并且b)大小是0字节.前者让你困惑,后者是非法的:即使是空目录也有4096字节的大小.但零是知道automount正确读取你的地图并拥有目录的简便方法.你也可以用df来检查:

  1. # df -k /mnt
  2. Filesystem 1K-blocks Used Available Use% Mounted on
  3. /etc/auto.master.d/mnt 0 0 0 - /mnt

现在让我们列出目标目录,即使父显然是空的:

  1. # ls -al /mnt/helvellyn
  2. total 761548
  3. drwxr-xr-x 2 root root 4096 Jun 23 13:21 .
  4. drwxr-xr-x 3 root root 0 Jun 27 07:31 ..
  5. -rw-r--r-- 1 root root 0 Jun 1 03:18 access_log
  6. -rw-r--r-- 1 root root 7485078 May 11 03:09 access_log-20140511
  7. -rw-r--r-- 1 root root 7052254 May 18 03:06 access_log-20140518
  8. -rw-r--r-- 1 root root 5357900 May 25 03:28 access_log-20140525
  9. -rw-r--r-- 1 root root 577579 May 25 16:36 access_log-20140601
  10. [...]

内容神奇地出现!现在让我们再次列出父母:

  1. # ls -al /mnt
  2. total 8
  3. drwxr-xr-x 3 root root 0 Jun 27 07:31 .
  4. dr-xr-xr-x 25 root root 4096 Jun 27 03:37 ..
  5. drwxr-xr-x 2 root root 4096 Jun 23 13:21 helvellyn

Automount确实可以进行需求驱动的安装(和卸载).由于/ mnt / helvellyn在您尝试访问它之前不会挂载,因此在第一次访问触发挂载之前无法看到它.

我希望你能原谅我补充一点,如果你从这个答案中汲取另一个教训,那么细节在UNIX系统管理员中至关重要.如果一条指令要求你做X,那么完全做X可能很重要,而不是你认为完全等同于X的东西.那个小的零大小的目录应该给你一些指示,表明有时候信息很少让你知道某些东西,特别是旧的UNIX东西,正常工作.如果通过不精确的方式,你滑过那些微小的标志,UNIX将不会给你任何其他东西继续,并可能导致混乱.

猜你在找的Linux相关文章