我有多个 Ubuntu 服务器,最近我安装了一些 11.04 服务器(和 1 个桌面),我刚刚发现重新启动后 nfs 挂载将无法挂载。
我尝试将 nfs-common 升级到最新版本(我只落后了一个小版本),但这只是稍微改变了我的错误。所有这些有问题的服务器都是我之前制作的服务器模板的克隆(vmWare),所以我认为这可能是模板的问题,因此也是所有克隆的问题。然后我尝试在 Desktop 11.04 上进行相同的安装,但遇到了同样的问题。大约一半的时间我可以按“S”跳过,但另一半时间服务器会冻结(我从最近的快照中恢复)。奇怪的是,如果我是能够进入系统,然后我可以顺利执行“mount -a”,它将挂载所有内容。这让我认为问题是 nfs 没有等待网络出现以尝试挂载。另一个让我想到这一点的原因是,我收到“无法解析主机”(到 NFS 点)错误,即使该主机位于 /etc/hosts 中。
这是我的 /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 ]
抱歉发了这么长的帖子,我只是想传达尽可能多的信息。有人对此有什么建议吗?我整天都在谷歌搜索,我尝试过使用 _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
/etc/hosts(相关条目):
10.1.1.43 NFSSERVER-priv
答案1
这是我为防止其他人遇到此问题并来此寻找解决方案而采取的解决方法:
在 /etc/init.d/ 中创建了一个脚本(mountall.sh):
#!/bin/bash
mount -r NFSSERVER-priv:/vol/vol1_isp/eshowcase/sites /var/www
mount NFSSERVER-priv:/vol/vol1_isp/vusers /var/users
让系统知道新的脚本:
update-rc.d mountall.sh defaults
选项“defaults”在运行级别 2、3、4 和 5 中放置一个启动 mountall.sh 的链接。(并在运行级别 0、1 和 6 中放置一个停止 mountall.sh 的链接。)
将文件修改为可执行文件
chmod +x mountall.sh
现在,当您 init 6 时,您应该有挂载点。在 fstab 中写一个“注释”也是一个好主意,这样人们就知道所有内容实际上是从哪里挂载的,因为那将是他们首先要查看的地方。
答案2
不确定这是否适用于你,但问题我正在是我尝试挂载的目录在启动时不可用。我尝试挂载到,/mnt
结果成功了。
答案3
将 ubuntu 14.04 升级到 14.10 后,我遇到了同样的问题。以下是为我解决问题的方法:
编辑/etc/default/nfs-common
并确保其内容为:
NEED_STATD=yes
重新启动后,我的 NFS 挂载就可以正常工作了。
答案4
如果您使用的是 Windows 8,那么肯定无法挂载 nfs 格式的磁盘,而这个问题的答案是“只需再次安装 Windows 8 并在设置中禁用休眠选项”,然后您才能够挂载 nfs 格式的磁盘。