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

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

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

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

@H_403_2@和相应的地图

# 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

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

# 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 ..

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

# df -k /mnt

Filesystem 1K-blocks Used Available Use% Mounted on

/etc/auto.master.d/mnt 0 0 0 - /mnt

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

# 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

[...]

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

# 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

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值