NFS 挂载在启动时失败

Sco*_*ley 7 server nfs boot mount

我有多个 Ubuntu 服务器,最近我安装了一些 11.04 服务器(和 1 个桌面),我刚刚发现在重新启动时 nfs 挂载不会挂载。

我已经尝试将 nfs-common 升级到最新版本(我只是落后了一个小修订版),但这只是稍微改变了我的错误。所有这些有问题的服务器都是我不久前制作的服务器模板的克隆 (vmWare),所以我认为这可能是模板的问题,因此它的所有克隆都有问题。然后我在桌面 11.04 上尝试了相同的安装,但我遇到了同样的问题。大约有一半时间我可以按“S”跳过,但另一半时间服务器会死机(并且我从最近的快照中恢复)。还什么奇怪的是,如果我能够进入系统然后我可以做一个“mount -a”就好了,它会安装所有东西。这让我认为问题在于 nfs 没有等待网络出现来尝试挂载。其他让我认为这是我收到“无法解析主机”(到 NFS 点)错误的原因,即使该主机在 /etc/hosts.conf 中。

这是我的 /var/log/boot.log

fsck from util-linux-ng 2.17.2
fsck from util-linux-ng 2.17.2
/dev/sda1 was not cleanly unmounted, check forced.
/dev/mapper/php53x-root: clean, 75641/1032192 files, 492673/4126720 blocks (check in 5 mounts)
init: portmap-wait (statd) main process (373) killed by TERM signal
init: statd main process (402) terminated with status 1
init: statd main process ended, respawning
init: statd-mounting main process (355) killed by TERM signal
mount.nfs: Failed to resolve server NFSSERVER-priv: Name or service not known
init: statd-mounting main process (416) killed by TERM signal
mount.nfs: Failed to resolve server NFSSERVER-priv: Name or service not known
init: statd main process (435) terminated with status 1
init: statd main process ended, respawning
init: statd main process (459) terminated with status 1
init: statd main process ended, respawning
mountall: mount /var/www [410] terminated with status 32
mountall: mount /var/users [436] terminated with status 32
init: statd-mounting main process (448) killed by TERM signal
init: statd main process (468) terminated with status 1
init: statd main process ended, respawning
init: statd main process (498) terminated with status 1
init: statd main process ended, respawning
/dev/sda1: 226/124496 files (1.3% non-contiguous), 39133/248832 blocks
mountall: fsck /boot [268] terminated with status 1
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
mountall: mount /var/users [583] terminated with status 32
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
mountall: mount /var/www [575] terminated with status 32
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
mountall: mount /var/www [638] terminated with status 32
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
mountall: mount /var/users [645] terminated with status 32
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
mountall: mount /var/www [724] terminated with status 32
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
mount.nfs: an incorrect mount option was specified
mountall: mount /var/users [729] terminated with status 32 Skipping /var/www at user request
 * Starting AppArmor profiles        [80G  [74G[ OK ]
 * Starting Name Service Cache Daemon nscd        [80G  [74G[ OK ]
FATAL: Module vmhgfs not found.
FATAL: Module vmsync not found.
FATAL: Module vmblock not found.
 * Loading open-vm-tools modules        [80G  [74G[ OK ]
 * Starting open-vm daemon vmtoolsd        [80G  [74G[ OK ]
Run Code Online (Sandbox Code Playgroud)

抱歉,帖子太长,只是想传达尽可能多的信息。有没有人对此有任何建议?我一整天都在谷歌上搜索,我尝试了 _netdev 并更改了 statd 的配置,但没有任何效果。我有 6 台服务器,这正在起作用。:\

/etc/fstab:(仅问题行 - 删除这些将允许其余的 nfs 挂载)

NFSSERVER-priv:/vol/vol1_isp/eshowcase/sites      /var/www       nfs     ro,defaults        0       0
NFSSERVER-priv:/vol/vol1_isp/vusers      /var/users       nfs     defaults        0       0
Run Code Online (Sandbox Code Playgroud)

/etc/hosts(相关条目):

10.1.1.43 NFSSERVER-priv
Run Code Online (Sandbox Code Playgroud)

Sco*_*ley 3

这是我所做的解决方法,以防其他人遇到这个问题并在这里寻找解决方案:

\n\n

在/etc/init.d/中创建了一个脚本(mountall.sh):

\n\n
#!/bin/bash\n\nmount -r NFSSERVER-priv:/vol/vol1_isp/eshowcase/sites /var/www\nmount    NFSSERVER-priv:/vol/vol1_isp/vusers          /var/users\n
Run Code Online (Sandbox Code Playgroud)\n\n

让系统知道新脚本:

\n\n
update-rc.d mountall.sh defaults\n
Run Code Online (Sandbox Code Playgroud)\n\n

选项 \xe2\x80\x9cdefaults\xe2\x80\x9d 放置一个在运行级别 2、3、4 和 5 中启动 mountall.sh 的链接。(并将停止 mountall.sh 的链接放置到 0、1 和 6 中。 )

\n\n

chmod 文件为可执行文件

\n\n
chmod +x mountall.sh\n
Run Code Online (Sandbox Code Playgroud)\n\n

现在,当您初始化 6 时,您应该拥有挂载点。在 fstab 中进行“注释”也是一个好主意,这样人们就知道所有内容实际上是从哪里安装的,因为这将是他们首先查看的位置。

\n