CentOS7挂载NFS

本文记录CentOS7作为客户端挂载NFS文件共享(含开机自动挂载)

环境示例说明

NFS 服务端: nfs.server.exp(192.168.1.10/24)
NFS 客户端: nfs.client.exp(192.168.1.100/24)

客户端安装必要的包

# yum install nfs-utils

配置客户端

修改域名(可选)

# vim /etc/idmap.conf

...
# 填写域名,此处是server.exp
Domain = server.exp
...

启动设置rpcbind服务

nfs服务依赖rpc远程过程调用服务

# systemctl start rpcbind
# systemctl enable rpcbind

准备挂载的目的路径

自定义目的路径,此处为"/vol/data"

# mkdir -p /vol/data

挂载NFS共享目录

服务端共享目录名为/nfsshare

# mount -t nfs nfs.server.exp:/nfsshare /vol/data

或者使用IP

# mount -t nfs 192.168.1.10:/nfsshare /vol/data

如果要指出挂载的NFS版本,添加相应的参数,如下:

# mount -t nfs -o vers=3 nfs.server.exp:/nfsshare /vol/data

配置自启自动挂载

# vim /etc/fstab

...
nfs.server.exp:/nfsshare    /vol/data    nfs    default    0 0
...

猜你喜欢

转载自blog.51cto.com/huanghai/2405023