NFS 共享不再在启动时挂载

NFS 共享不再在启动时挂载

我有一个 NAS 设备,并通过以下条目在其上挂载了几个目录/etc/fstab:-

# NFS
number0:/projects /home/carl/number0/projects nfs rw 0 0
number0:/carl /home/carl/number0/stuff nfs rw 0 0
number0:/Qmultimedia /home/carl/Music nfs rw 0 0
number0:/Photos /home/carl/Pictures nfs rw 0 0

最近(可能是自从更新以来,虽然我不确定),NFS 共享在启动时没有安装,我必须使用 来安装它们sudo mount -a

由于我自 Ubuntu 10.04(可能更早)以来一直使用相同的 fstab 条目,我怀疑 fstab 标准发生了一些变化,我不再遵守。

AU 上有很多关于 NFS 无法自动挂载的问题,但都与较旧的 Ubuntu 版本有关,除了这个,这似乎不相关。

编辑:的输出sudo zegrep -w nfs /var/log/*

/var/log/syslog.7.gz:Jul  8 19:35:16 number2 ureadahead[214]: ureadahead:/var/lib/nfs/.etab.lock: No such file or directory
/var/log/syslog.7.gz:Jul  8 19:35:16 number2 ureadahead[214]: ureadahead:/var/lib/nfs/.xtab.lock: No such file or directory
/var/log/syslog.7.gz:Jul  8 19:35:16 number2 kernel: [    4.974103] systemd[1]: Job nfs-blkmap.service/start failed with result 'dependency'.
/var/log/syslog.7.gz:Jul  8 19:35:20 number2 kernel: [   19.287387] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
/var/log/syslog.7.gz:Jul  8 19:35:26 number2 mount[767]: mount.nfs: Failed to resolve server number0: Temporary failure in name resolution
/var/log/syslog.7.gz:Jul  8 19:35:26 number2 mount[770]: mount.nfs: Failed to resolve server number0: Temporary failure in name resolution
/var/log/syslog.7.gz:Jul  8 19:35:26 number2 mount[773]: mount.nfs: Failed to resolve server number0: Temporary failure in name resolution
/var/log/syslog.7.gz:Jul  8 19:35:26 number2 mount[774]: mount.nfs: Failed to resolve server number0: Temporary failure in name resolution
/var/log/syslog.7.gz:Jul  8 19:35:26 number2 mount[775]: mount.nfs: Failed to resolve server number0: Temporary failure in name resolution
/var/log/syslog.7.gz:Jul  8 19:42:50 number2 kernel: [  470.817815] FS-Cache: Netfs 'nfs' registered for caching

NFS 服务器是 number0,它一直在运行(我还有另一台机器也连接到同一个 NFS 共享)。

carl@number2:~$ ping number0
PING number0.home (192.168.1.65) 56(84) bytes of data.
64 bytes from number0.home (192.168.1.65): icmp_seq=1 ttl=64 time=0.364 ms

编辑 2:@waltinator 要求我检查这些目录的存在和权限

carl@number2:~$ ls -l /var/lib | grep nfs
drwxr-xr-x 5 statd         nogroup       4096 Jul 21 17:55 nfs

carl@number2:~$ ls -l /var/lib/nfs | grep v4recovery
drwxr-xr-x 2 root  root    4096 Apr 27 23:05 v4recovery

编辑:共享实际上出现在 Nautilus 中,但未被安装。

答案1

您是否尝试过将服务器名称(number0)更改为 IP(192.168.1.65)?

看起来,在挂载时名称解析存在问题。

例如从以下更改:

number0:/projects /home/carl/number0/projects nfs rw 0 0

192.168.1.65:/projects /home/carl/number0/projects nfs rw 0 0

答案2

都怪 systemd。很可能是最近更新导致的。需要明确告知它等待网络准备就绪后再尝试挂载。

systemctl enable NetworkManager-wait-online.service

很好的解释这里

相关内容