autofs:自动挂载器
自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的NFS挂载
自动挂载器由autofs服务脚本管理
自动挂载器由auto.master配置文件进行配置,该文件引用了一个按惯例称作/etc/auto.misc或其他类似名称的二级配置文件
autofs与NFS两者之间配后用的还是比较多的
mount命令参数非常多,如下为与NFS相关的参数。
(1)-a:把/etc/fstab中列出的路径全部挂载。
(2)-t:需要mount的类型,如nfs等。
(3)-r:将mount的路径定为read only。
(4)-v mount:过程的每一个操作都有message传回到屏幕上。
(5)rsize=n:在NFS服务器读取文件时NFS使用的字节数,默认值是1 024个字节。
(6)wsize=n:向NFS服务器写文件时NFS使用的字节数,默认值是1 024个字节。
(7)timeo=n:从超时后到第1次重新传送占用的1/7秒的数目,默认值是7/7秒。
(8)retry=n:在放弃后台mount操作之前可以尝试的次数,默认值是7 000次。
(9)soft:使用软挂载的方式挂载系统,若Client的请求得不到回应,则重新请求并传回错误信息。
(10)hard:使用硬挂载的方式挂载系统,该值是默认值,重复请求直到NFS服务器回应。
(11)intr:允许NFS中断文件操作和向调用它的程序返回值,默认不允许文件操作被中断。
(12)fg:一直在提示符下执行重复挂载。
(13)bg:如果第1次挂载文件系统失败,继续在后台尝试执行挂载,默认值是失败后不在后台处理。
(14)tcp:对文件系统的挂载使用TCP,而不是默认的UDP。
说明:mount NFS服务器的另一个重要参数是hard(硬)mount或soft(软)mount。
采用hard mount,NFS客户机会不断地尝试与NFS服务器连接(在后台一般不会给出任何提示信息),直到挂载上为止。
采用soft mount,会在前台尝试与NFS服务器连接,当收到错误信息后终止mount尝试,并给出相关信息。
######################简单配置###########################
1、挂载本地分区
在RHEL5.5中默认的是已经安装了autofs软件包了
[[email protected] ~]# rpm -qa autofs
autofs-5.0.1-0.rc2.143.el5
[[email protected] ~]#
[[email protected] ~]# grep -v ‘^#‘ /etc/auto.master
/misc /etc/auto.misc
#misc是神奇目录,auto.master定义了神奇目录为misc auto.misc是自动挂载的配置文件
/net -hosts
+auto.master
[[email protected] ~]# grep -v ‘^#‘ /etc/auto.misc
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
#cd为目标目录名称 中间段则为挂载选项 最后是挂载目录
[[email protected] ~]#
[[email protected] misc]# ls
[[email protected] misc]# grep sda4 /etc/auto.master
/misc/sda4 /etc/auto.sda --timeout=60
[[email protected] misc]# grep sda4 /etc/auto.sda
sda4 -fstype=ext3 :/dev/sda4
[[email protected] misc]# service autofs start //启动服务
启动automount: [确定]
[[email protected] misc]# ls //神奇目录自动出现
sda4
[[email protected] misc]# cd sda4/
[[email protected] sda4]# ls //进入之后还是什么都没有
[[email protected] sda4]# cd sda4 //直接cd sda4,神奇的一刻到了,竟然进去了
[[email protected] sda4]# pwd
/misc/sda4/sda4
[[email protected] sda4]# ls
lost+found
[[email protected] sda4]# mount | grep sda4 //mount显示挂载成功
/dev/sda4 on /misc/sda4/sda4 type ext3 (rw)
[[email protected] sda4]#
2、挂载NFS共享目录
[[email protected] ~]# cat /etc/exports
/tmp 192.168.0.0/24(rw)
[[email protected] ~]# service nfs restart
关闭NFS mountd: [失败]
关闭NFS 守护进程: [失败]
关闭NFS quotas: [失败]
关闭NFS 服务: [失败]
启动NFS 服务: [确定]
关掉NFS 配额: [确定]
启动NFS 守护进程: [确定]
启动NFS mountd: [确定]
[[email protected] ~]# showmount -e 127.0.0.1
Export list for 127.0.0.1:
/tmp 192.168.0.0/24
[[email protected] ~]# vi /etc/auto.master
[[email protected] ~]# grep tmp /etc/auto.master
/misc/tmp /etc/auto.nfs
[[email protected] ~]# vi /etc/auto.nfs
[[email protected] tmp]# grep tmp /etc/auto.nfs
tmp -typefs=nfs,rw 127.0.0.1:/tmp
#这里是本地测试,远程测试的话把IP地址修改为远程NFS服务端即可
[[email protected] ~]# service autofs restart
停止automount: [确定]
启动automount: [确定]
[[email protected] ~]# cd /misc/tmp/tmp
[[email protected] tmp]# ls
gconfd-root scim-panel-socket:0-root whatis.Qs3891
mapping-root setuplog.txt
[[email protected] tmp]#
3、挂载samba
挂载samba这里就不作演示了,除了在auto.master中加入之前类似语句,再建立一个auto.smb的文件,填入:
windows -fstype=smbfs,username=admin%password ://hostname/ShareFolder
即可
4、挂载本地镜像
[[email protected] ~]# grep iso /etc/auto.master
/misc/iso /etc/auto.iso
[[email protected] ~]# cat /etc/auto.iso
iso -fstype=iso9660,ro,nosuid,nodev,loop :/root/rhel5u5.iso
[[email protected] ~]# service autofs restart
停止automount: [确定]
启动automount: [确定]
[[email protected] ~]# cd /misc/
[[email protected] misc]# ls
iso
[[email protected] misc]# cd iso/
[[email protected] iso]# ls
[[email protected] iso]# cd iso
[[email protected] iso]# ls
Cluster README-te.html RELEASE-NOTES-U5-en
ClusterStorage README-zh_CN.html RELEASE-NOTES-U5-en.html
EULA README-zh_TW.html RELEASE-NOTES-U5-es.html
eula.en_US RELEASE-NOTES-as.html RELEASE-NOTES-U5-fr.html
GPL RELEASE-NOTES-bn.html RELEASE-NOTES-U5-gu.html
------省略------
[[email protected] iso]# mount | grep rhel5u5.iso
/root/rhel5u5.iso on /misc/iso/iso type iso9660 (ro,nosuid,nodev,loop=/dev/loop1)
[[email protected] iso]#
autofs如此便可以结合yum安装软件了,不安装的时候就不挂载,安装软件的时候就自动去挂载
[[email protected] mnt]# tail -5 /etc/yum.repos.d/rhel-debuginfo.repo
[repo]
name=repo
baseurl=file:///misc/iso/iso/Server
enabled=1
gpgcheck=0
[[email protected] mnt]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything
[[email protected] mnt]# yum list
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
repo | 1.3 kB 00:00
repo/primary | 753 kB 00:00
repo 2348/2348
------省略------
#####################################
autofs自动挂载
时间: 2024-08-07 17:00:07
autofs自动挂载的相关文章
autofs 自动挂载.
autofs 自动挂载. 操作环境:redhat 6 一.autofs 说明 自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的挂载 自动挂载器由autofs服务脚本管理 自动挂载器由auto.master配置文件进行配置,该文件引用了一个按惯例称作/etc/auto.misc 二.安装autofs [[email protected] home]# yum install autofs 三.配置autofs [[email protected] home]# rpm
NFS网络文件系统+autofs自动挂载
(1)实例:服务器端使用NFS服务输出/cxm目录为只读,/cxm下的目录为读写,并且开机自启动:客户端使用autofs服务自动挂载服务器输出的目录,并且1分钟无操作自动卸载. 服务器端:rhel6.3(192.168.200.122) [[email protected] 桌面]# mkdir /cxm #新建父目录 [[email protected] 桌面]# mkdir /cxm/zyk #新建子目录 [[email protected] 桌面]# ll -d /cxm #查看父
Linux 第八周上课笔记(2) nfs,ldap网络帐号,autofs自动挂载服务
######################NFS############################ nfs 手动挂载方式 1)yum install nfs-utils 2)showmount -e ip ##识别该ip下的共享 3)mount ip:/sharedir /mountpoint ##挂载点 挂载目录 永久挂载方式 方法一 vim /etc/fstab 172.25.254.250:/nfsshare/nfs1 /m
RHCE7.0答案之Autofs自动挂载
Autofs自动挂载: yum -y install autofs vim /etc/auto.master 在文件中添加下面行 /home/guests /etc/auto.tianyun vim /etc/auto.tianyun 子挂载点监控 ldapuser0 -rw,sync classroom:/home/guests/ldapuser0 systemctl enable autofs.service systemctl restart autofs.service ls /hom
Autofs 自动挂载服务
autofs 自动挂载服务 需求:把下面这两条命令做成自动挂载 172.16.2.6:/share/soft /share/soft 172.16.2.6:/share/iso /share/iso 客户端: 1.# mkdir/share (挂载点) 2.# vim /etc/auto.master /share /etc/auto.share --后面这个文件不存在,自定义的名字 3.# vim /etc/auto.share soft - 172.16.2.6:/
ldap网络账号和autofs自动挂载用户家目录服务
{***第八单元ldap网络帐号***} 1.ldap是什么 ldap目录服务认证,和windows活动目录类似,就是记录数据的一种方式 2.ldap客户端所需软件 yum sssd krb5-workstation -y 3.如何开启ldap用户认证 authconfig-tui ldap的tls证书缺失,需要到服务器端下载所需要的证书到/etc/openldap/cacerts, 下载证书: wget http://172.25.254.254/pub/example-ca.crt 重新执行
centos配置NFS服务和autofs自动挂载服务
NFS:Network File System 网络文件系统,基于内核的文件系统.Sun公司开发,通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件,基于RPC(Remote Procedure Call Protocol远程过程调用)实现. RPC采用C/S模式.客户机请求程序调用进程发送一个有进程参数的调用信息到服务进程,然后等待应答信息.在服务器端,进程保持睡眠状态直到调用信息到达为止.当一个调用信息到达,服务器获得进程参数,计算结果,发送答复信息,然后等待下一个调用信息
linux系统autofs自动挂载服务
自动挂载autofs命令 涉及服务haldaemon和messagebus两个服务有关,保证两个服务是开启. ***现在想在客户端10.10.10.10自动挂载服务器10.10.10.254上的/share/soft和/share/iso两个目录,该如何配置? 在客户端10计算机上配置 1.mkdir /share 2.vim /etc/auto.master /share /etc/auto.share --后面的auto.share文件不存在,名字自定义. 3.# vim /et
Autofs自动挂载服务
一.环境准备 Xuegod63.cn 服务端 Xuegod64.cn 客户端 二.搭建服务 1. 服务端配置: 安装NFS 服务: [[email protected] ~]# yum -yinstall nfs-utils 创建共享区域: [[email protected] ~]# mkdir -p/opt/abc123 修改配置文件: [[email protected] ~]# vim/etc/exports /op