大网数据广告活动
服务器运维问答

Mounting NFS - How to fail fast?

· 52CE 我爱测

I have a NAS. On my Linux desktop, I mount a partition of the NAS via NFS. The NAS isn't always switched on. When I need to use it, then I switch it on and use mount -a on my desktop. The related entry on my /etc/fstab is: 192.16…

问题原文

原帖链接 · Pie Faced · CC BY-SA 3.0

I have a NAS. On my Linux desktop, I mount a partition of the NAS via NFS.

The NAS isn't always switched on. When I need to use it, then I switch it on and use mount -a on my desktop.

The related entry on my /etc/fstab is:

192.168.1.110:/mnt/HD/HD_a2 /mnt/nas nfs rw,noatime,nodiratime 0 0

When the NAS is switched on, mount -a works fine and mounts the NAS partition.

However, when the NAS is not switched on, mount -a would hang, for very long (I'm not sure if it ever returns...). At this point when I switch on my NAS, the mount will succeed and return.

How can I get mount -a to return (without mounting the NAS partition of course) if the NAS is not switched on instead of waiting?

已采纳解答

原帖链接 · Sergiu Tot · CC BY-SA 3.0

If you want to use fstab, you can use the timeo parameter. But it's not the most elegant way to do it.

autofs is the proper way to handle NFS shares. You can find a good start here:

If you have trouble configure it, just let me know where you got stuck.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。