centos系统磁盘网络共享

1、在CentOS服务器上安装NFS服务器组件:

sudo yum install nfs-utils

2、配置NFS共享: 编辑/etc/exports

/dev/sdb1    192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)

仅共享目录:

/data/share    192.168.1.0/24(rw,sync,no_subtree_check,no_root_squash)

3、启动并启用NFS服务: 启动NFS服务并设置其开机自启:

sudo systemctl start nfs-server

sudo systemctl enable nfs-server

sudo systemctl restart nfs-server

为了使更改生效,还需要刷新NFS共享:sudo exportfs -ra

在远程服务器上挂载共享硬盘:

1、安装NFS客户端(若尚未安装):

sudo yum install nfs-utils

2、创建挂载点: 在远程服务器上创建一个本地目录作为挂载点:

sudo mkdir /share

sudo mkdir /share/a3177

3、挂载NFS共享: 使用

sudo mount -t nfs 192.168.1.1:/dev/sdb1 /share/a3177

仅挂载共享目录:

sudo mount -t nfs 192.168.1.1:/data/share /share/a3177

 

至此,目标CentOS系统的硬盘应该已经成功挂载到远程服务器了。

 

远程共享目录无效的情况下,确保本地能正常启动,挂载配置可保存在:

/etc/rc.d/rc.local

mount -t nfs 192.168.1.1:/data/share /share/a3177

 

记得添加可执行权限:

chmod +x /etc/rc.d/rc.local

默认分类 2024-04-25 19:24:51 通过 网页 浏览(524)

共有0条评论!

发表评论

更换一道题!
放大的图片