将服务器B(10.75.50.120)的目录挂载到服务器A上。
sudo mount -t nfs 10.75.50.120:/opt/share/gaojing/snapdragon-auto-gen3-hqx-1-2-1_hlos_dev_qnx /home/gaojing/workspace/qnx_nfs/
报错:
mount.nfs: access denied by server while mounting 10.75.50.120:/opt/share/gaojing
检查权限:
sudo vim /etc/exports:
/opt/share *(insecure,rw,sync,no_root_squash)
/opt/work *(rw,sync,no_root_squash)
调试:
mount -e localhost
mount -e 10.75.50.120
报错:
clnt_create: RPC: Program not registered
解决:
systemctl restart nfs-kernel-server
systemctl restart rpcbind
重启nfs和rpcbind(最终有效)。
调试记录:
sudo systemctl status nfs-kernel-server
service nfs-kernel-server status
sudo systemctl start rpcbind.service
sudo service nfs-kernel-server restart
sudo vi /etc/exports
其他错误信息: //客户端没有安装nfs服务
mount.nfs: remote share not in 'host:dir' format
mount.nfs: requested NFS version or transport protocol is not supported
调试信息:
gaojing@bs158:/mnt$ ps aux|grep nfs
root 25867 0.0 0.0 0 0 ? I< 16:33 0:00 [nfsiod]
gaojing 31263 0.0 0.0 14436 964 pts/0 S+ 17:18 0:00 grep --color=auto nfs
gaojing@bs158:/mnt$ sudo service nfs-kernel-server restart
Failed to restart nfs-kernel-server.service: Unit nfs-kernel-server.service not found.
gaojing@bs158:/mnt$ sudo service nfs-common restart
Failed to restart nfs-common.service: Unit nfs-common.service is masked.
gaojing@bs158:/mnt$ sudo service nfs start
Failed to start nfs.service: Unit nfs.service not found.
安装nfs:
sudo apt-get install nfs-kernel-server
gaojing@bs158:/mnt$ ps aux|grep nfs
root 25867 0.0 0.0 0 0 ? I< 16:33 0:00 [nfsiod]
root 32235 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32236 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32237 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32238 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32239 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32240 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32241 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
root 32242 0.0 0.0 0 0 ? S 17:21 0:00 [nfsd]
gaojing 32751 0.0 0.0 14436 1044 pts/0 S+ 17:21 0:00 grep --color=auto nfs
|