我在centos 5.3中把一个磁盘挂载为/local,在/local/foldera/folderb/下我有很多文件夹,如下:
drwxrwxrwx root root 4096 DEC 10 10:40 Platformxx
然后我构建了另一台服务器,并且在服务器上有许多类似上述的平台。我想使用 autofs 通过 nfs 自动将这些文件夹挂载到我的服务器。只需使用 mount 命令一切正常。然后我选择使用 autofs。在 /etc/auto.master 中我这样写道:
/local/foldera/folderb /etc/auto.nfs
并在 /etc/auto.nfs 中:
Platformxx -rw,soft xx.xx.xx.xx:/xx/Platformxx
配置完成后,服务器 autofs 重新加载。当我打开文件夹 b 中的每个文件夹时,错误告诉我系统找不到该文件夹。而且我在文件夹 b 中看不到任何内容。命令“ll”返回总计 0。在我删除添加到 auto.master 的记录并重新启动服务器后,这些文件夹又回来了。那么问题出在哪里
答案1
您会看到预期的行为。如果您想使用“ls /local/foldera/folderb”查看文件夹,请使用--ghost
auto.master 中的选项:
/local/foldera/folderb /etc/auto.nfs --ghost
答案2
只需快速更新,该--ghost
选项已被弃用,并已被替换为browse
-来源
[no]browse
This is an autofs specific option that is a pseudo
mount option and so is given without a leading
dash. Use of the browse option pre-creates mount
point directories for indirect mount maps so the
map keys can be seen in a directory listing without
being mounted. Use of this option can cause
performance problem if the indirect map is large so
it should be used with caution. The internal
program default is to enable browse mode for
indirect mounts but the default installed
configuration overrides this by setting BROWSE_MODE
to "no" because of the potential performance
problem. This option does the same as the
deprecated --ghost option, the browse option is
preferred because it is used by other autofs
implementations.