一.NFS文件详解

1. /data/            表示需要共享的目录。

2. IP                表示允许哪个客户端访问。

3. IP                后括号里的设置表示对该共享文件的权限。

4. ro                只读访问

5. rw                读写访问

6. sync              所有数据在请求时写入共享

7. all_squash         共享文件的UID和GID映射匿名用户anonymous,适合公用目录。

8. no_all_squash      保留共享文件的UID和GID(默认)

9. root_squash        root用户的所有请求映射成如anonymous用户一样的权限(默认)

10. no_root_squash    root用户具有根目录的完全管理访问权限

二. NFS服务器搭建与autofs自动挂载

(1).安装NFS服务器

1 yum install nfs-utils -y   #安装nfs

2 systemctl start nfs        #开启nfs服务

3 systemctl enable nfs       #开机自启动

(2).配置NFS服务器

1 mkdir /westos

2 echo 'hello,world' > /westos/hello  # 建立目录 /westos, 在其中创建测试文件hello

(3).通过修改NFS配置,共享/data/share/目录

[root@nfsserver ~]# mkdir /data/share

[root@nfsserver ~]# vim /etc/exports 
shared data for bbs by oldboy at 20160825
#/data/share           192.168.100.0/24(rw,sync,hide)
/data/share           192.168.100.0/24(rw,sync,anonuid=555,anongid=555,all_squash)

(4).客户端安装NFS客户端及autofs并启动相关服务

[root@nfsclient ~]# yum install rpcbind nfs-utils -y

[root@nfsclient ~]# yum install autofs -y

[root@nfsclient ~]# /etc/init.d/rpcbind start

[root@nfsclient ~]# /etc/init.d/autofs start

(5).服务器测试

1 showmount -e 192.168.1.152

2 Export list for 192.168.1.152:

3 /westos *

(6).配置客户端自动挂载(autofs)NFS服务端共享目录

[root@nfsclient ~]# vim /etc/auto.master 
     # Sample auto.master file

# This is a 'master' automounter map and it has the following format:

# mount-point [map-type[,format]:]map [options]

# For details of the format look at auto.master(5).

#/misc   /etc/auto.misc

/mnt    /etc/auto.misc  timeout=60#/mnt为挂载点   /etc/auto.misc为挂载动作

[root@nfsclient ~]# vim /etc/auto.misc

# This is an automounter map and it has the following format

# key [ -mount-options-separated-by-comma ] location

# Details may be found in the autofs(5) manpage

cd  -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
# the following entries are samples to pique your imagination

#linux  -ro,soft,intr ftp.example.org:/pub/linux

#boot  -fstype=ext2   :/dev/hda1

#floppy -fstype=auto   :/dev/fd0

#floppy  -fstype=ext2   :/dev/fd0

#e2floppy  -fstype=ext2  :/dev/fd0

#jaz -fstype=ext2  :/dev/sdc1

#removable -fstype=ext2  :/dev/hdd

nfsdata  -fstype=nfs  192.168.100.100:/data/share

(7).重新启动autofs服务,并检查自动挂载文件是否生效

[root@nfsclient ~]# /etc/init.d/autofs restart

[root@nfsclient ~]# cd /mnt/nfsdata

[root@nfsclient nfsdata]# ls - total 0
        -rw-r--r-- 1 oldgirl oldgirl 0 Aug 27 00:14 andy

-rw-r--r-- 1 oldgirl oldgirl 0 Aug 27 00:10 oldboy

-rw-rw-r-- 1 oldgirl oldgirl 0 Aug 27 00:10 oldgirl

[root@nfsclient nfsdata]# df –h

Filesystem  Size  Used Avail Use% Mounted on

Filesystem   /dev/mapper/vg_muban-moban_root  38G 1.9G 34G  6% /

tmpfs  491M    0 491M  0%/

dev/shm/dev/sda1       194M  29M 155M 16%/boot

192.168.100.100:/data/share  38G  1.9G   34G   6% /mnt/nfsdata

三.用以上方式完成NFS服务器搭建与autofs自动挂载

NFS服务器搭建与autofs自动挂载的更多相关文章

  1. Linux:SAMBA共享、NFS共享、Autofs自动挂载

    SAMBA.NFS共享区别 NFS开源文件共享程序:NFS(NetworkFile System)是一个能够将多台Linux的远程主机数据挂载到本地目录的服务,属于轻量级的文件共享服务,不支持Linu ...

  2. Linux服务——二、配置NFS及autofs自动挂载服务

    一.NFS服务配置步骤 NFS的作用:能够使两台虚拟机之间实现文件共享.数据同步 准备:主机名.网络.yum源 Server端: 1.安装nfs-util和rpcbind:(图形化自带) [root@ ...

  3. 2-5-NFS服务器配置和autofs自动挂载-配置Samba服务器配置现实文件共享

    大纲: NFS服务器运行原理 实战配置NFS服务器 配置Samba服务器配置现实文件共享 ----------------------------------------------- 问题: # 怎 ...

  4. linux autofs自动挂载

    autofs:自动挂载器 自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的NFS挂载 自动挂载器由autofs服务脚本管理 自动挂载器由auto.master配置文件进行配 ...

  5. Linux之NFS服务搭建及autofs服务搭建

    NFS 网络文件系统,英文Network File System(NFS),是由SUN公司研制的UNIX表示层协议(presentation layer protocol),能使使用者访问网络上别处的 ...

  6. Linux之我有你也有-共享平台NFS服务器搭建

    Linux之我有你也有-共享平台NFS服务器搭建 最近因工作需要,所以要搭一个共享的服务器用于存储.实现你有我有大家有的共享的和谐局面.想到了NFS-Network File System.接下来我便 ...

  7. autofs 自动挂载.

    autofs 自动挂载. 操作环境:redhat 6 一.autofs 说明 自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的挂载 自动挂载器由autofs服务脚本管理 自 ...

  8. NFS服务器搭建-共享PC与ARM主板文件

    NFS服务器搭建-共享PC与ARM主板文件 在搭建好交叉编译环境之后需要实现目标板与宿主机的文件共享,在这里选择NFS,由于资料较多.需要注意的以下几点: 目标板与宿主机需要连接在同一个网段内. 宿主 ...

  9. NFS使用autofs自动挂载

    NFS自动挂载设置在/etc/fstab和/etc/rc.local可能挂载不成功,假如是服务端NFS宕机还可能导致客户端无法启动,可以使用autofs实现自动挂载 安装autofs yum -y i ...

  10. 实现nfs持久挂载+autofs自动挂载

    实验环境: 两台主机 node4:192.168.37.44 NFS服务器 node2:192.168.37.22 客户端 在nfs服务器,先安装nfs和rpcbind [root@node4 fen ...

随机推荐

  1. [seaborn] seaborn学习笔记5-小提琴图VIOLINPLOT

    文章目录 5 小提琴图Violinplot 1. 基础小提琴图绘制 Basic violinplot 2. 小提琴图样式自定义 Custom seaborn violinplot 3. 小提琴图颜色自 ...

  2. Web初级——模块和Bom

    模块导入 导出声明 定义时声明 在定义声明函数.类时不用加分号 // 导出数组 export let months = ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep' ...

  3. 02-逻辑仿真工具VCS使用

    逻辑仿真工具VCS使用 1 Makefile执行VCS仿真 # Makefile for simulating the full_adder.v with the simulator VCS # -- ...

  4. C#中检查null的语法糖,非常实用

    c#处理null的几个语法糖,非常实用.(尤其是文末Dictionary那个案例,记得收藏) ??如果左边是的null,那么返回右边的操作数,否则就返回左边的操作数,这个在给变量赋予默认值非常好用. ...

  5. 案例:用ajax 方法 解析xml

    xml文件 <?xml version="1.0" encoding="utf-8"?> <studentlist> <stude ...

  6. react 高效高质量搭建后台系统 系列 —— 系统布局

    其他章节请看: react 高效高质量搭建后台系统 系列 系统布局 前面我们用脚手架搭建了项目,并实现了登录模块,登录模块所依赖的请求数据和antd(ui框架和样式)也已完成. 本篇将完成系统布局.比 ...

  7. Spring03-IOC-循环依赖的实现(Debug查看spring解决循环依赖的过程)

    1 什么是循环依赖 如下,有类A和B,A中有一个类型为B的属性b,B中有一个类型为A的属性a,A和B相互依赖 public class A { private B b; public B getB() ...

  8. springcloud 09 spring cloud gateway01 基本介绍

    官网:https://cloud.spring.io/spring-cloud-static/spring-cloud-gateway/2.2.1.RELEASE/reference/html/ 1. ...

  9. STM32F1库函数初始化系列:定时器中断

    1 static void TIM3_Configuration(void) //10ms 2 { 3 TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; 4 ...

  10. odoo 为可编辑列表视图字段搜索添加查询过滤条件

    实践环境 Odoo 14.0-20221212 (Community Edition) 需求描述 如下图,列表网仓记录详情页面(form视图),编辑内联视图中的货主记录,为货主和仓库字段搜索,添加过滤 ...