fedora25的nfs文件系统搭建

时间:2021-12-21 18:07:14

关于NFS的原理介绍可以参考这篇文章:http://blog.51cto.com/atong/1343950

1> nfs服务端 安装nfs工具包和rpcbind包

dnf install nfs-utils   rpcbind

2> 配置nfs需要共享的目录

vim /etc/exports

/nfs-directory/ *(ro,no_root_squash,sync,nohide)

3> 使能并启动RPC服务和NFS服务:
#systemctl enable rpcbind.service
#systemctl enable nfs-server.service

#systemctl restart rpcbind.service
#systemctl restart nfs-server.service

查看这两个服务的状态可通过下列命令实现:
#systemctl status rpcbind.service
#systemctl status nfs-server.service
注意,RPC的状态是Active: active (running);而NFS的状态是Active: active (exited)

4> 去nfs客户端去执行挂载

mount -t nfs nfs-server-ip-address:/nfs-share-directory     /target-dir

注意:nfs-server-ip-address只有IP地址,不需要添加用户名,否则会报“mount.nfs: Failed to resolve server root@10.xxx.xxx.xxx: Name or service not known”