centos建立vm间nfs共享

服务器端:

 

  • 查看nfs和rpcbind是否安装:

 

    rpm -qa | grep "nfs"

    

    rpm -qa | grep "rpcbind"

  • 新建共享目录/root/opt/nfs/sharedir,并编译vi /etc/exports,设置服务端的共享目录
  • /root/opt/nfs/sharedir *(rw,sync,no_root_squash)
  • 重启rpcbind和nfs服务
  • systemctl restart rpcbind
  • systemctl restart nfs
  • 查看nfs启动状态
  • systemctl status nfs
  •  

客户端:

 

新建共享目录:mkdir /nfs/

查看服务端共享目录

 

showmount -e server_ip(如果是k8s集群,为内部ip)

 

mount -t nfs -o rw server_ip:share_dir shar_dir_client

 

开启rpcbind服务, systemctl start rpcbind

设置rpcbind开机启动:chkconfig rpcbind on

 

挂载共享目录

如:mount -t nfs -o rw 172.31.0.13:/root/opt/nfs/sharedir /nfs

查看挂载情况df

设置开机自动挂载:

vi /etc/fstab

添加:

172.31.0.13:/root/opt/nfs/sharedir      /nfs    nfs   rw,udp   0 0

 

解除挂载:

umount /nfs

挂载中遇到错误查看服务器端log:

tail /var/log/messages

 

mount时报错:rpc.statd is not running but is required for remote locking

解决办法:客户端开启rpcbind:systemctl start rpcbind

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值