---
title: "linux 使用NSF 映射远程磁盘目录"
author: "喧嚣求静"
date: "2018-02-03T09:28:06Z"
tags: []
categories: ["操作系统"]
slug: "linux-nsf"
draft: false
lastmod: "2018-02-03T09:28:06Z"
id: 2410122
url: "https://913.iteye.com/blog/2410122"
---

**linux 使用NSF 映射远程磁盘目录**

**假设源目录在192.168.1.1机器上，目录为/data**

**客户端集群在192.168.1.2， 需要将192.168.1.1机器上的/data目录到本地的/data目录**

 

 

**1、在两台机器上安装nsf 、 portmap**

**yum  install  nfs-utils  portmap** 

 

 

**2、在192.168.1.1机器上面修改/etc/exports文件，加入如下内容**

**/data/ 192.168.1.2(rw,sync,no\_root\_squash)** 

**表示开放本机器上面/data目录， 主机192.168.1.2对该目录拥有rw权限。**

**然后启用nsf与portmap服务:**

**service rpcbind start**  

**service nfs start**   

 

 

**3、在192.168.1.2机器上面启动nsf与portmap服务然后挂载remote目录**

**service rpcbind start**  

**service nfs start**   

**将机器192.168.1.1上面的/data目录挂在到本机的/data目录下面**

**mount -t nfs 192.168.1.1:/data/  /data/**  

 

 

**mount不上可以服务端看日志：**

 

**cat /var/log/messages | grep mount**