linux服务器内网磁盘映射、文件夹共享存储

1、当前局域网两台服务器:
服务器1:192.168.1.2
服务器2:192.168.1.3
如果是虚拟机或者云主机需要在安全组增加允许tcp 任何端口 访问 192.168.1.0/24

想把服务器2:192.168.1.3的某个文件夹或某块磁盘挂载到服务器1:192.168.1.2的/home/share路径进行文件同步存储

2、开始设置
2.1 服务器1:192.168.1.2 设置

$yum -y install nfs
$vi /etc/exports
--编辑 此内网网段对/home/share均可读写
/home/share 192.168.1.*/24(rw,sync)
----保存
$chmod -R 775 /home
$service rpcbind start
$service nfs start
$chkconfig nfs on 
$chkconfig rpcbind on

2.2 服务器2:192.168.1.3 设置

$yum -y install nfs
$service rpcbind start
$service nfs start
$chkconfig nfs on 
$chkconfig rpcbind on

2.3 映射设置 在服务器2:192.168.1.3

$mkdir /home/share
$mount -t nfs 172.16.1.18:/home/share /home/share
$df -h    #查看挂载结果

OK 成功

猜你喜欢

转载自blog.csdn.net/weixin_36914964/article/details/81807539