NFS 裝載在啟動時失敗

NFS 裝載在啟動時失敗

我有多個 Ubuntu 伺服器,最近我安裝了一些 11.04 伺服器(和 1 個桌面),我剛剛發現重新啟動後 nfs 掛載將無法掛載。

我嘗試將 nfs-common 升級到最新版本(我只落後了一個小版本),但這只是稍微改變了我的錯誤。所有這些有問題的伺服器都是我不久前製作的伺服器模板的克隆(vmWare),所以我認為這可能是模板及其所有克隆的問題。然後我在桌面 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 的連結。)

chmod 檔案為可執行檔

chmod +x mountall.sh

現在,當您初始化 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格式的磁碟。

相關內容