首页 > 其他分享 >autofs随记

autofs随记

时间:2022-11-01 14:59:23浏览次数:62  
标签:auto misc etc nfs autofs master 随记

官方文档地址:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/nfs-autofs#doc-wrapper

基本使用:

以在Centos7.9为例:

1.安装autofs

yum install -y autofs

2.主配置文件

cat /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
#
# NOTE: mounts done from a hosts map will be mounted with the
#    "nosuid" and "nodev" options unless the "suid" and "dev"
#    options are explicitly given.
#
/net    -hosts
#
# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
#
+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master

 

3.基本使用方法:

3.1.使用相对路径时的语法:

/etc/auto.master格式:

挂载点的dirname 指定配置文件路径

指定配置文件格式

挂载点的basename 挂载选项 被挂载的位置

 

3.2.使用绝对路径的语法

/etc/auto.master格式:

/-   指定配置文件路径

指定配置文件格式

挂载点绝对路径 挂载选项 被挂载的位置

 

 

4.测试使用(使用nfs)

nfs地址:192.168.1.237
nfs配置文件内容:
/nfs/absolutely 192.168.1.*(rw,sync,all_squash)
/nfs/relative  192.168.1.*(rw,sync,all_squash)


4.1.使用相对路径

vim /etc/auto.master

# 在末尾加入
/nfs /etc/relative.misc


vim /etc/relative.misc

relative  -fstype=nfs,rw,sync,no_root_squash  192.168.1.237:/nfs/relative 

重启autofs

systemctl restart autofs

 

 

 

 4.2.使用绝对路径

mkdir /test/absolutely -p

vim /etc/master

/- /etc/absolutely.misc

vim /etc/absolutely.misc

/test/absolutely -fstype=nfs,rw,sync,no_root_squash 192.168.1.237:/nfs/absolutely

重启autofs

systemctl restart autofs

 

标签:auto,misc,etc,nfs,autofs,master,随记
From: https://www.cnblogs.com/wyllearning/p/16847653.html

相关文章

  • 十问:霍金(随记)
    -------------------------------------------------------我在这个星球上过着一种非凡的生活,我利用奇思妙想和物理定律穿越宇宙。我到过银河系的最远处,旅行进入过黑洞,还......
  • kafka随记
    一、概述1.定义传统定义:kafka是一个分布式的基于发布/订阅模式的消息队列最新定义:kafka是一个开源的分布式事件流平台,被数千家公司用于高性能数据管道、流分析、数据集......
  • Windows重装随记
    0.前情提要最近被人喊去修电脑,虽然计算机真的不是修电脑专业但还是去了。电脑表现为:打开任意一个文档,比如txt,doc,写点东西,保存,再打开,一定会变成乱码。经过若干次测试发现......
  • 关于数据库的一些随记
    脏读指当一个事务正在访问数据,并且对数据进行了修改,而这种修改还没有提交到数据库中,这时,另外一个事务也访问这个数据,然后使用了这个数据。因为这个数据是还没有提交的数据,......
  • Kotlin使用随记
    泛型扩展方法//方法一fun<T,R>appendFunction01(input:T,mkf:T.()->R):R{returninput.mkf()}//方法二fun<T,R>T.appendFunction02(mkf:T.(T)......
  • 随记
    占内存4个字节的整数的最小值为什么是-2147483648而不是-2147483647?int型数据-2147483648-1的值为什么不是-2147483649? 因为计算机是以补码的形式来存储数字的,不管......
  • C#语法随记
    C#语法随记解释在一个点击事件中看见了这行代码Event?.Invoke(),小白表示一脸懵逼。其实比较简单,简单说就是Event不为null,则Invoke();是属于C#6的语法,?.是空值传播运......
  • 随记
    linuxtree文件树pkill-9xxxx根据名字杀死进程可加快解析速度的配置:vim/etc/resolv.conf#阿里dns解析nameserver223.5.5.5nameserver223.5.5.5`````......
  • 随记笔记
    事事往往像硬币两面,一边是头一边是字,你不能只看他一边哪,凡是哪有谁是全对,谁是全错的,总之但求情之所在,心之所安就算了。1、聪明,只适用于当时,而智慧可以永久,传承。就像酒......
  • 随记-随时编辑
    fromfunctoolsimportreducedefadd(x,y):#两数相加returnx+ysum1=reduce(add,[1,2,3,4,5])#计算列表和:1+2+3+4+5print(sum1)fromfunctoo......