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

文件服务器(被挂载机):192.168.1.100

操作机(挂载到机):192.168.1.200

也就是说,你在操作机上进行的操作,实际上都到文件服务器上去了;

 

1. 开启NFS服务:

在文件服务器(被挂载机)上

# chkconfig --level 35 nfs on  //开启NFS开机运行

# service nfs start  //手动启动服务

 

2. 编辑/etc/exports文件:

加入:

/tmp 192.168.1.100 (rw,sync,no_root_squash)  //编辑需要共享的目录和允许访问的服务器及权限。
  或
/opt/apache-tomcat-6.0.37/webapps/fileShare/file * (rw,sync,no_root_squash)
/mnt * (ro,sync)

 

3. 在被搭载机上新建目录,配置权限:

在操作机(挂载到机)上

# mkdir /tmp
# chmod 777 -R /tmp

 

4. 建立连接:

在操作机(挂载到机)上

mount 192.168.1.100:/tmp /tmp

 

5. 开机自动挂载:

将这行

mount 192.168.1.100:/tmp /tmp

添加到/etc/rc.local,开机就会自动挂载了

posted @ 2016-09-08 16:03  木子执手  阅读(21932)  评论(0编辑  收藏  举报