我最近将我们的一台机器升级到了 lenny 的 Debian Squeeze。以前,这些机器安装了 2 个 NFS 共享 /home 和 /home/scans/data
升级后,它们一次只能安装一个。如果我尝试将它们一起安装,则会收到以下错误:
mount.nfs:挂载时服务器拒绝访问(空)
我还必须在 fstab 文件中指定 vers=3,否则由于 nfs 服务器仍在 Lenny 上,它们根本无法挂载。
自升级以来,权限方面没有任何变化。Lenny 上还有其他机器仍在运行,并且安装了两个共享。
该机器的 fstab 条目:
nfs:/home /home nfs vers=3,exec,suid,nodev,nolock 0 0
nfs:/home/scans/data /home/scans/data nfs vers=3,exec,suid,nodev,nolock 0 0
答案1
我最终弄清楚了这个问题。
我使用 Debian Squeeze 在虚拟机上构建了我们的 NFS 服务器副本。在 fstab 文件中指定 vers=3 时,我可以正常挂载共享。看起来只是 Debian 5 和 Debian 6 之间的版本不匹配。
答案2
嗯...那么您的 NFS 服务器名为nfs
?我想知道解析您的代码是否fstab
将其解释为协议类型而不是主机名。这意味着主机名实际上为空,这与错误消息中的内容一致。
我会尝试在您的hosts
文件中添加一个别名,然后在您的fstab
.
如果失败的话,请尝试showmount -e nfs
。
答案3
从 Ubuntu LTS 14.04 开始,mount 采用 -o 'vers=3' 并且可以工作,但 fstab 需要 nfsver。
# sudo mount -t nfs -o 'vers=3' -v 192.168.1.101:/data/info /share/info
fstab:
192.168.1.101:/data/info /share/info nfs user,rw,nfsvers=3,auto 0 0
这需要很长时间(超过 20 秒)。而且,它似乎不遵守“自动”标志,需要在启动后手动安装。
我不知道为什么 fstab 对我来说与其他回答者的语法不同,但是 Vim 语法高亮会在“nfsvers”上触发而不是“vers”,所以我怀疑它已经这样很长一段时间了。
另一件需要考虑的事情是,根据https://wiki.archlinux.org/index.php/NFS/Troubleshooting导出的目录实际上必须位于 /srv 下。但这并没有使 nfsv4 对我起作用。
有人在更新时确实破坏了 nfs 吗?
答案4
我在使用 slackware 和最新的 nfs 1.3.3 时遇到了同样的问题,我找到了这个解决方案,只需检查 /etc/nfsmount.conf(在 ubuntu 上可能有其他名称)并从 nfsmount.conf 开始,如下所示(所有选项都是标准默认设置,没有任何修改,均已注释)
#
# /etc/nfsmount.conf - see nfsmount.conf(5) for details
#
# This is an NFS mount configuration file. This file can be broken
# up into three different sections: Mount, Server and Global
#
# [ MountPoint "Mount_point" ]
# This section defines all the mount options that
# should be used on a particular mount point. The '<Mount_Point>'
# string need to be an exact match of the path in the mount
# command. Example:
# [ MountPoint "/export/home" ]
# background=True
# Would cause all mount to /export/home would be done in
# the background
#
# [ Server "Server_Name" ]
# This section defines all the mount options that
# should be used on mounts to a particular NFS server.
# Example:
# [ Server "nfsserver.foo.com" ]
# rsize=32k
# wsize=32k
# All reads and writes to the 'nfsserver.foo.com' server
# will be done with 32k (32768 bytes) block sizes.
#
[ NFSMount_Global_Options ]
# This statically named section defines global mount
# options that can be applied on all NFS mount.
#
# Protocol Version [2,3,4]
# This defines the default protocol version which will
# be used to start the negotiation with the server.
# Defaultvers=4
#
# Setting this option makes it mandatory the server supports the
# given version. The mount will fail if the given version is
# not support by the server.
# Nfsvers=4
#
# Network Protocol [udp,tcp,rdma] (Note: values are case sensitive)
# This defines the default network protocol which will
# be used to start the negotiation with the server.
# Defaultproto=tcp
#
# Setting this option makes it mandatory the server supports the
# given network protocol. The mount will fail if the given network
# protocol is not supported by the server.
# Proto=tcp
#
# The number of times a request will be retired before
# generating a timeout
# Retrans=2
#
# The number of minutes that will retry mount
# Retry=2
#
# The minimum time (in seconds) file attributes are cached
# acregmin=30
#
# The Maximum time (in seconds) file attributes are cached
# acregmin=60
#
# The minimum time (in seconds) directory attributes are cached
# acregmin=30
#
# The Maximum time (in seconds) directory attributes are cached
# acregmin=60
#
# Enable Access Control Lists
# Acl=False
#
# Enable Attribute Caching
# Ac=True
#
# Do mounts in background (i.e. asynchronously)
# Background=False
#
# Close-To-Open cache coherence
# Cto=True
#
# Do mounts in foreground (i.e. synchronously)
# Foreground=True
#
# How to handle times out from servers (Hard is STRONGLY suggested)
# Hard=True
# Soft=False
#
# Enable File Locking
# Lock=True
#
# Enable READDIRPLUS on NFS version 3 mounts
# Rdirplus=True
#
# Maximum Read Size (in Bytes)
# Rsize=8k
#
# Maximum Write Size (in Bytes)
# Wsize=8k
#
# Maximum Server Block Size (in Bytes)
# Bsize=8k
#
# Ignore unknown mount options
# Sloppy=False
#
# Share Data and Attribute Caches
# Sharecache=True
#
# The amount of time, in tenths of a seconds, the client
# will wait for a response from the server before retransmitting
# the request.
# Timeo=600
#
# Sets all attributes times to the same time (in seconds)
# actimeo=30
#
# Server Mountd port mountport
# mountport=4001
#
# Server Mountd Protocol
# mountproto=tcp
#
# Server Mountd Version
# mounvers=3
#
# Server Mountd Host
# mounthost=hostname
#
# Server Port
# Port=2049
#
# RPCGSS security flavors
# [none, sys, krb5, krb5i, krb5p ]
# Sec=sys
#
# Allow Signals to interrupt file operations
# Intr=True
#
# Specifies how the kernel manages its cache of directory
# Lookupcache=all|none|pos|positive
#
# Turn of the caching of that access time
# noatime=True