如何利用mount命令挂载另一台服务器上的目录

文件服务器(目标挂载机)- 192.168.11.100
操作机(文件挂载到机)- 192.168.11.105

第一步:确保安装了 nfs-util、portmap
$ rpm -q nfs-util portmap // 某些系统不需要portmap
$ yum install nfs-util portmap -y

第二步:开启nfs服务,在目标挂载机上
$ chkconfig --level 35 nfs on //开启NFS开机运行
$ systemctl start nfs

第三步:编辑/etc/exports文件,在目标挂载机上
/tmp 192.168.11.100 (rw,sync,no_root_squash) //编辑需要共享的目录和允许访问的服务器及权限

第四步:操作机上,设置权限

$ mkdir /tmp
$ sudo chmod 777 -R /tmp

第五步:操作机上,建立连接

$ mount 192.168.11.100:/tmp /tmp

$ mount -t nfs 192.168.11.100:/tmp /tmp(/localdir)

第六步:操作机上,开机自动挂载

将如下这行,添加到/etc/rc.local,实现开机自动挂载
mount 192.168.1.100:/tmp /tmp

其他:
参考-https://www.cnblogs.com/puloieswind/p/5853401.html

posted on 2022-04-25 15:04  韩山隐士  阅读(1365)  评论(0编辑  收藏  举报