SSH*_*SSH 6 nfs mount mountpoint 12.04
我是 linux 新手,我有一个非常基本的问题。我有三台机器-
machineA 10.108.24.132
machineB 10.108.24.133
machineC 10.108.24.134
Run Code Online (Sandbox Code Playgroud)
所有这些机器都安装了 Ubuntu 12.04,我对所有这三台机器都有 root 访问权限。
现在我应该在上面的机器上做下面的事情 -
Create mount point /opt/exhibitor/conf
Mount the directory in all servers.
sudo mount <NFS-SERVER>:/opt/exhibitor/conf /opt/exhibitor/conf/
Run Code Online (Sandbox Code Playgroud)
/opt/exhibitor/conf如上所述,我已经在所有这三台机器中创建了目录。
现在我试图在所有这三台机器上创建一个挂载点。所以我遵循了以下过程 -
以上三台机器都安装NFS支持文件和NFS内核服务器
$ sudo apt-get install nfs-common nfs-kernel-server
Run Code Online (Sandbox Code Playgroud)
在以上三台机器上创建共享目录
$ mkdir /opt/exhibitor/conf/
Run Code Online (Sandbox Code Playgroud)
/etc/exports在以上三台机器中编辑并添加了这样的条目 -
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/opt/exhibitor/conf/ 10.108.24.*(rw)
Run Code Online (Sandbox Code Playgroud)
以上三台机器都运行exportfs
root@machineA:/# exportfs -rv
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "10.108.24.*:/opt/exhibitor/conf/".
Assuming default behaviour ('no_subtree_check').
NOTE: this default has changed since nfs-utils version 1.0.x
exporting 10.108.24.*:/opt/exhibitor/conf
Run Code Online (Sandbox Code Playgroud)
现在我做showmount了machineA
root@machineA:/# showmount -e 10.108.24.132
Export list for 10.108.24.132:
/opt/exhibitor/conf 10.108.24.*
Run Code Online (Sandbox Code Playgroud)
而且我已经在上述所有三台机器上启动了这样的 NFS 服务器 -
sudo /etc/init.d/nfs-kernel-server start
Run Code Online (Sandbox Code Playgroud)
现在当我这样做时,我收到了一个错误 -
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
mount.nfs: access denied by server while mounting 10.108.24.132:/opt/exhibitor/conf
Run Code Online (Sandbox Code Playgroud)
我也试过从 machineB 和 machineC 做同样的事情,但我仍然得到同样的错误 -
root@machineB:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
root@machineC:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
Run Code Online (Sandbox Code Playgroud)
我的/etc/exports文件看起来不错吗?因为我在所有三台机器上都有相同的内容。以及是否有任何与 NFS 相关的日志,我可以看到这些日志以找到任何线索?
知道我在这里做错了什么吗?
更新:-
所以我的etc/exports文件在所有三台机器上都是这样的 -
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/opt/exhibitor/conf/ 10.108.24.132(rw)
/opt/exhibitor/conf/ 10.108.24.133(rw)
/opt/exhibitor/conf/ 10.108.24.134(rw)
Run Code Online (Sandbox Code Playgroud)
只是一个快速检查 - 如上所述,我为每台机器获取的 IP 地址是这样的 -
root@machineB:/# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:ad:5b:a7
inet addr:10.108.24.133 Bcast:10.108.27.255 Mask:255.255.252.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5696812 errors:0 dropped:12462 overruns:0 frame:0
TX packets:5083427 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7904369145 (7.9 GB) TX bytes:601844910 (601.8 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:187144 errors:0 dropped:0 overruns:0 frame:0
TX packets:187144 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:24012302 (24.0 MB) TX bytes:24012302 (24.0 MB)
Run Code Online (Sandbox Code Playgroud)
这里我为 machineB 使用的 IP 地址是10.108.24.133.
小智 0
刚刚快速浏览了一下导出手册页。我认为通配符“*”仅适用于基于主机名的导出。如果您希望导出到 MachineB 和 MachineC,我会首先尝试导出为:
10.108.24.0/24(rw)
Run Code Online (Sandbox Code Playgroud)
..看看情况如何。这将导出到 10.108.24.1-254(可用)。如果这绝对不是您想要的,请尝试分别指定每个 IP 地址:
10.108.24.133(rw) 10.108.24.134(rw)
Run Code Online (Sandbox Code Playgroud)
干杯
SC。
如果你有 nfs 文件系统那么
1.安装nfs-common sudo apt-get install nfs-common
2.sudo nano /etc/fstab然后输入以下内容
server.me.lab:/path/to/folder /home/foo nfs rsize=8192,wsize=8192,timeo=14,intr,noatime
3.创建挂载点
mkdir /home/foo
Run Code Online (Sandbox Code Playgroud)
4.sudo mount -a