我有一台运行 Ubuntu Server 14.04 LTS 的无头服务器,安装了所有最新更新。它使用 NFS 共享多个文件夹。
/etc/exports 文件的内容如下:
# add folders we want to share through NFS
/mnt/raiddisk/john (rw)
/mnt/raiddisk/vm (rw)
/mnt/raiddisk (rw)
/mnt/raiddisk/filecopy (rw)
/mnt/raiddisk/movies (rw)
/mnt/raiddisk/jane (rw)
/mnt/raiddisk/svn (rw)
/home/vboxuser2 (rw)
/var/www/server.johndoe.home/public_html (rw)
/home/john (rw)
我的客户端计算机(2)正在运行 Ubuntu Desktop 14.04 LTS,并安装所有最新更新。两台计算机在启动时都突然无法挂载 NFS 共享文件夹。
以下仅是我的 /etc/fstab 文件的相关内容:
# mount the NFS folders from the server
192.168.1.20:/mnt/raiddisk/john /mnt/john nfs auto,defaults 0 0
192.168.1.20:/mnt/raiddisk/vm /mnt/vm nfs auto,defaults 0 0
192.168.1.20:/home/vboxuser2 /mnt/vboxuser2 nfs auto,defaults 0 0
192.168.1.20:/mnt/raiddisk /mnt/raiddisk nfs auto,defaults 0 0
192.168.1.20:/var/www/server.johndoe.home/public_html /mnt/server-www nfs auto,defaults 0 0
192.168.1.20:/home/john /mnt/johnhome nfs auto,defaults 0 0
直到几天前,这个设置都运行得很好。在我的客户端机器上,文件夹在启动时被挂载。
但是现在(我认为自从最近更新以来)当我启动机器时这些文件夹没有被安装。
仅当我在终端中手动运行以下命令后它们才会挂载:
sudo mount -a
以下是 sudo mount -a -v 的输出:
mount.nfs: timeout set for Sun Aug 16 23:40:00 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: timeout set for Sun Aug 16 23:40:00 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: timeout set for Sun Aug 16 23:40:00 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: timeout set for Sun Aug 16 23:40:00 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: timeout set for Sun Aug 16 23:40:00 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=192.168.1.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot UDP port 36461
mount.nfs: portmap query retrying: RPC: Timed out
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.1.20 prog 100005 vers 3 prot TCP port 42598
mount.nfs: portmap query failed: RPC: Remote system error - Connection timed out
mount.nfs: Connection timed out
mount.nfs: timeout set for Sun Aug 16 23:42:11 2015
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.20,clientaddr=192.168.1.7'
在客户端机器上,当我在 /var/log 中搜索任何与 NFS 相关的行时,我得到以下输出(我只选择了最近的条目):
/var/log/syslog:Aug 16 13:23:34 ubuntu kernel: [ 15.128595] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog:Aug 16 13:23:34 ubuntu rpc.idmapd[875]: main: open(/run/rpc_pipefs/nfs): No such file or directory
/var/log/syslog:Aug 16 21:44:48 ubuntu kernel: [30119.650872] nfs: server 192.168.1.20 not responding, timed out
/var/log/syslog:Aug 16 21:48:00 ubuntu kernel: [30312.356845] nfs: server 192.168.1.20 not responding, timed out
/var/log/syslog:Aug 16 22:55:50 ubuntu kernel: [ 15.444005] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.1:Aug 16 13:04:35 ubuntu kernel: [ 15.876127] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.2.gz:Aug 15 14:00:52 ubuntu kernel: [ 17.467940] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.3.gz:Aug 14 22:12:45 ubuntu kernel: [ 14.015935] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.3.gz:Aug 14 22:12:45 ubuntu rpc.idmapd[898]: main: open(/run/rpc_pipefs/nfs): No such file or directory
/var/log/syslog.4.gz:Aug 12 22:49:49 ubuntu kernel: [ 12.920639] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.4.gz:Aug 12 22:49:49 ubuntu rpc.idmapd[910]: main: open(/run/rpc_pipefs/nfs): No such file or directory
/var/log/syslog.5.gz:Aug 11 21:33:11 ubuntu kernel: [ 14.363706] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.6.gz:Aug 10 21:29:28 ubuntu kernel: [ 12.760663] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.6.gz:Aug 10 21:29:29 ubuntu rpc.idmapd[890]: main: open(/run/rpc_pipefs/nfs): No such file or directory
/var/log/syslog.7.gz:Aug 6 20:58:35 ubuntu kernel: [ 15.475703] FS-Cache: Netfs 'nfs' registered for caching
/var/log/syslog.7.gz:Aug 7 07:37:22 ubuntu kernel: [ 12.183087] FS-Cache: Netfs 'nfs' registered for caching
/var/log/udev:KERNEL[15.324744] add /module/nfs (module)
/var/log/udev:DEVPATH=/module/nfs
/var/log/udev:UDEV [15.325094] add /module/nfs (module)
/var/log/udev:DEVPATH=/module/nfs
我不确定我需要检查什么来确定问题。我已经检查了用户权限和文件权限,没有任何变化。
我假设有一些与 NFS 相关的更新导致我的配置在某种程度上不兼容?
答案1
虽然我还是不知道为什么会突然发生这种情况。但我找到了一种解决方法。
由于mount -a
在终端中运行会挂载 NFS 共享,因此建议我将该命令添加到 /etc/rc.local 并让其在启动时自动运行。
因此编辑 /etc/rc.local 并mount -a
在行前添加exit 0
。
现在,启动客户端后,NFS 共享就会再次安装,无需我手动执行任何操作。