如何挂载网络文件系统?

如何挂载网络文件系统?

我正在尝试在远程机器上挂载文件系统:

root@Wolf:/# mount -t nfs 192.168.0.131:/disc2 /temp
mount.nfs: mount system call failed

经过长时间的停顿后才出现错误。

我可以 ping 机器等等。没有网络问题。

/temp存在于本地机器上。

/disc2存在于远程机器上并/dev/sdb5已安装在那里。

我在某处读到了我需要的内容apt-get install nfs-kernel-server nfs-common portmap,并且我确实在远程机器上执行了这些操作(然后两者都执行了,以确保万无一失):

Package nfs-kernel-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  nfs-common

好的,apt-get install nfs-common portmap那么:

Note, selecting 'rpcbind' instead of 'portmap'
nfs-common is already the newest version.
rpcbind is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

那么,嗯,这样就好了。不是吗?

编辑:不知道这个,谢谢 dubu,但读了一些资料,并创建了这个文件:

root@barnard:~# cat /etc/exports
/disc2/oldstuff1  192.168.0.0(rw)
/disc2/oldstuff2  192.168.0.0(rw)
/digex            192.168.0.0(r)

我认为是这样。不是吗? 这一页告诉我/etc/init.d/portmap restart,因为我得到的rpcbind是:

root@barnard:~# /etc/init.d/rpcbind restart
[ ok ] Stopping rpcbind daemon....
[ ok ] Starting rpcbind daemon....

那么,它起作用了。不是吗?同一页面显示/etc/init.d/nfs-kernel-server reload,但根据 apt-get 消息,它已被替换为nfs-common

root@barnard:~# /etc/init.d/nfs-common restart
[ ok ] Stopping NFS common utilities: idmapd statd.
[ ok ] Starting NFS common utilities: statd idmapd.

这听起来很积极。那么现在,在客户端:

root@Wolf:/# mount -t nfs 192.168.0.131:/disc2/digex /temp
mount.nfs: mount system call failed

还是没有喜悦。

编辑2:

root@barnard:~# exportfs -ra
-bash: exportfs: command not found
root@barnard:~# which exportfs
root@barnard:~# find / -name "exportfs"
root@barnard:~#

嗯。我读到过它安装在某处nfs-kernel-server,但 apt 就是不允许我安装它,并报告说the following packages replace it: nfs-common,并且nfs-common is already the newest version....非常深的呼吸...

那么,这肯定是罪魁祸首。除非我能安装好它,否则它不可能工作。但我该如何安装它呢?

昨晚我睡眠不足,在某个时候我添加了一些 apt 源,但显然没有更新它。这一次我做了大量apt-get update的事情,下载了很多东西,最重要的是:

Selecting previously unselected package nfs-kernel-server.
Setting up nfs-kernel-server (1:1.2.6-4) ...
Replacing config file /etc/exports with new version

Creating config file /etc/default/nfs-kernel-server with new version
[ ok ] Starting NFS common utilities: statd idmapd.
[warn] Not starting NFS kernel daemon: no exports. ... (warning).

没问题,复制/etc/exports之前的数据,重启服务,没有好转,重启整个机器以确保万无一失。但还是不行。

最后:在成功使用 apt-get 之后,经过大量侦查工作(主要涉及tail /var/log/syslog(感谢 MKaama - 以后要记住的),并匹配所有相关目录,我终于让它工作了。现在剩下的只是一些调整和整理。

我想我可以从这里开始处理。非常感谢大家的帮助。

答案1

如果远程系统上的导出文件内容如下:

/disc2/oldstuff1  192.168.0.0(rw)
/disc2/oldstuff2  192.168.0.0(rw)
/digex            192.168.0.0(r)

那么你应该发出

mount -t nfs 192.168.0.131:/digex /temp

并不是

mount -t nfs 192.168.0.131:/disc2/digex /temp

相关内容