在问这个问题之前,我搜索了stackoverflow,但是答案没有用:
mount: nfs access denied by server

在我的VM中,我的VM中有sdasdb硬盘。

然后VM具有ips:192.168.8.101192.168.8.104

当我将sdb的目录挂载到/var下的VM的目录时:

[root@ha-node1 sdb]# mount -t nfs 192.168.8.104:/mnt/sdb/var/lib/glance/images /var/lib/glance/images


得到以下错误:


  mount.nfs:安装192.168.8.104时服务器拒绝访问:/ mnt / sdb / var / lib / glance / images


/mnt权限下的目录都是完美的。

[root@ha-node1 sdb]# ll -d /mnt/
drwxr-xr-x. 4 root root 26 Jul 26 00:43 /mnt/
[root@ha-node1 sdb]# ll -d /mnt/sdb
drwxr-xr-x 4 root root 4096 Jul 26 10:05 /mnt/sdb
[root@ha-node1 sdb]# ll -d /mnt/sdb/var/
drwxr-xr-x 3 root root 4096 Jul 26 10:05 /mnt/sdb/var/
[root@ha-node1 sdb]# ll -d /mnt/sdb/var/lib/
drwxr-xr-x 3 root root 4096 Jul 26 10:05 /mnt/sdb/var/lib/
[root@ha-node1 sdb]# ll -d /mnt/sdb/var/lib/glance/
drwxr-xr-x 3 root root 4096 Jul 26 10:05 /mnt/sdb/var/lib/glance/
[root@ha-node1 sdb]# ll -d /mnt/sdb/var/lib/glance/images/
drwxr-xr-x 2 root root 4096 Jul 26 10:05 /mnt/sdb/var/lib/glance/images/


网络连接也可以。

[root@ha-node1 sdb]# ping 192.168.8.104
PING 192.168.8.104 (192.168.8.104) 56(84) bytes of data.
64 bytes from 192.168.8.104: icmp_seq=1 ttl=64 time=0.024 ms
64 bytes from 192.168.8.104: icmp_seq=2 ttl=64 time=0.030 ms
64 bytes from 192.168.8.104: icmp_seq=3 ttl=64 time=0.032 ms
64 bytes from 192.168.8.104: icmp_seq=4 ttl=64 time=0.031 ms


NFS服务正常运行:

[root@ha-node1 sdb]# systemctl status nfs.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
   Active: active (exited) since Wed 2017-07-26 00:26:23 CST; 11h ago
  Process: 1916 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 1786 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 1916 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Jul 26 00:26:22 ha-node1 systemd[1]: Starting NFS server and services...
Jul 26 00:26:23 ha-node1 systemd[1]: Started NFS server and services.


在日志中,我grep挂载:

[root@ha-node1 sdb]# cat /var/log/messages | grep mount
Jul 24 14:44:07 ha-node1 systemd: tmp.mount: Directory /tmp to mount over is not empty, mounting anyway.
Jul 26 00:12:08 ha-node1 systemd: Started dracut pre-mount hook.
Jul 26 00:12:11 ha-node1 systemd: Started dracut mount hook.
Jul 26 00:12:15 ha-node1 systemd: Started Remount Root and Kernel File Systems.
Jul 26 00:23:44 ha-node1 rpc.mountd[4312]: Version 1.3.0 starting
Jul 26 00:26:02 ha-node1 systemd: Started dracut pre-mount hook.
Jul 26 00:26:04 ha-node1 systemd: Started dracut mount hook.
Jul 26 00:26:08 ha-node1 systemd: Started Remount Root and Kernel File Systems.
Jul 26 00:26:22 ha-node1 rpc.mountd[1561]: Version 1.3.0 starting
Jul 26 00:43:03 ha-node1 kernel: EXT4-fs (sdb): mounted filesystem with ordered data mode. Opts: (null)
Jul 26 00:43:13 ha-node1 kernel: EXT4-fs (sdc): mounted filesystem with ordered data mode. Opts: (null)
Jul 26 10:07:03 ha-node1 rpc.mountd[1561]: refused mount request from 192.168.8.104 for /mnt/sdb/var/lib/glance/images (/): not exported


它显示not exported,我尝试了exportfs -r,但没有用。

有人可以告诉我,为什么我不能NFS将sdb挂载到self目录?

最佳答案

在Linux OS下,导出到外部的目录由文件'/ etc / exports'控制。
加:
/ mnt / sdb / var / lib / glance / images *(rw,sync,no_subtree_check)
在该文件中,然后重试。这仅是您的一个示例,应根据具体要求修改访问权限。请阅读出口手册。

关于linux - mount.nfs:安装192.168.8.104时服务器拒绝访问:/mnt/sdb/var/lib/glance/images,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45316959/

10-10 17:48