Linux autofs技术小结

1.autofs安装

https://www.cndba.cn/hbhe0316/article/106528
https://www.cndba.cn/hbhe0316/article/106528
#yum install autofs –y

2.编辑文件https://www.cndba.cn/hbhe0316/article/106528https://www.cndba.cn/hbhe0316/article/106528

#cat /etc/auto.master | grep -i "pgmcifs"
/-      /etc/auto.pgmcifs

#cat /etc/auto.pgmcifs
/home/PGM/Server        -fstype=cifs,rw,domain=.,username=username,password=password,sec=ntlmssp,uid=2011,gid=5001,file_mode=0755,dir_mode=0755,vers=3.0 ://xx.xx.xx.xxx/Server

3.重启autofs

https://www.cndba.cn/hbhe0316/article/106528
#systemctl enable autofs.service
#systemctl restart autofs.service
  1. 针对autofs开启日志,打开autofs日志后,日志会打印到/var/log/message下。
    #vi /etc/autofs.conf
    logging = debug
#systemctl restart autofs.service

重启autofs生效https://www.cndba.cn/hbhe0316/article/106528

  1. 针对autofs网络抓包,enp0s8为实际的网卡名称。
    #tcpdump -i enp0s8 -w /tmp/tcpdump.cap &

6.重启重现时候停止脚本,脚本每隔十分钟检查一次是否重现问题,如果重现问题,则kill掉tcpdump命令。https://www.cndba.cn/hbhe0316/article/106528https://www.cndba.cn/hbhe0316/article/106528

#chmod +x /home/tcpdump.sh
#cat /home/tcpdump.sh
#!/bin/sh
cd /home/PGM/Server > /dev/null 2>&1
if [[ $? -ne 0 ]];then
 kill -9 `ps -ef | grep tcpdump | grep -v grep | awk -F ' ' {'print $2'}`
fi
cd /

#crontab –l
*/10 * * * * /home/tcpdump.sh

7.autofs配置timeout参数,如果TIMEOUT=0,则表示umount掉挂在目录,默认TIMEOUT=300,表示默认5分钟umount掉挂载掉。https://www.cndba.cn/hbhe0316/article/106528

https://www.cndba.cn/hbhe0316/article/106528
#cat /etc/autofs.conf | grep -w timeout | grep -v "#"
timeout = 300

该设置需要重启autofs生效。

#systemctl restart autofs.service

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linuxautofs是一个自动挂载文件系统的服务。它可以根据需要自动挂载文件系统,而无需手动操作。在安装和配置完成后,可以使用systemctl命令来启动和启用autofs服务。例如,使用以下命令启动和启用autofs服务: \[root@service ~\]# systemctl start autofs \[root@service ~\]# systemctl enable autofs 启用服务后,可以使用systemctl status命令来检查autofs服务的状态。例如,使用以下命令检查autofs服务的状态: \[root@service ~\]# systemctl status autofs 安装autofs服务后,会生成一些配置文件和目录。例如,可以使用ls命令来查看生成的文件和目录: \[root@service ~\]# ls /etc/auto* /etc/autofs.conf /etc/auto.master /etc/auto.net /etc/autofs_ldap_auth.conf /etc/auto.misc /etc/auto.smb /etc/auto.master.d 如果需要手动挂载镜像文件并使用YUM方式安装autofs,可以使用mount命令来挂载镜像文件,并使用yum命令来安装autofs。例如,使用以下命令挂载镜像文件并安装autofs: \[root@service ~\]# mount /dev/sr0 /mnt/ \[root@service ~\]# yum install -y autofs 总结起来,autofs是一个自动挂载文件系统的服务,可以通过systemctl命令启动和启用,安装后会生成一些配置文件和目录,可以使用mount命令手动挂载镜像文件并使用yum命令安装autofs。 #### 引用[.reference_title] - *1* *2* *3* [【Linuxautofs自动挂载](https://blog.csdn.net/tianlong1929/article/details/129678976)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值