- autofs:在客户端实现自动挂载卸载的软件
- 安装:
dnf install autofs.x86_64 -y
- 配置方式:
vim /etc/auto.master
- 最终挂载点的上层目录 自动以子策略文件
- /mnt /etc/auto.samba(自己定义)
- vim 自动以子策略文件(/etc/auto.samba)
- 最终挂载点 挂载参数 挂载资源
samba -fstype=cifs,username=westos,password=westos ://192.168.1.30/
westosdir
systemctl restart autofs
- 测试:
cd /mnt/samba
df
cd /root
等待资源闲置超时 ##默认300秒 vim /etc/autofs.conf ---->Timeout=3
df
挂载资源自动卸载
- 可改变默认超时时间
vim /etc/autofs.conf