日期:2014-05-16  浏览次数:20655 次

两台 linux 机器之间mount
比如我有两台 linux 机器,192.168.1.1  192.168.1.2
现在我要将 192.168.1.1 下的/opt/mydir 目录挂在到 192.168.1.2 /opt/mydir1 目录下。
需要以下操作:
1.服务器端 192.168.1.1
  在/etc/exports 目下添加共享目录
  /opt/mydir 192.168.1.2(rw)
/opt/mydir   hostname(rw)
hostname  是指192.168.1.2 的hostname, 需要在/etc/hosts 中添加 hosts

2.启动192.168.1.1 的nfs 服务
         /etc/rc.d/init.d/portmap start (在REDHAT中PORTMAP是默认启动的)
   /etc/rc.d/init.d/nfs start 启动NFS服务
   /etc/rc.d/init.d/nfs stop 停止NFS服务


3.在192.168.1.2 上mount 目录
#mount -t nfs -o rw 192.168.1.1:/opt/mydir /opt/mydir1