前言
这个是在客户端实现自动挂载的软件。
对于本地固定设备可以使用mount,像硬盘;但是光盘,软盘,SMB,NFS等文件系统具有动态性,即需要的时候才有必要挂载。autofs服务就提供能够及时挂载动态加载的文件系统的功能。免去我们手动挂载的麻烦和资源的浪费。
autofs的安装
dnf install autofs.x86_64 -y
systemctl enable --now autofs.service
cd /net 开启autofs服务时会自动建立/net服务
建立自动挂载策略
-
设置自动挂载主策略文件
vim /etc/auto.master
最终挂载点的上层目录 | 自动挂载子策略文件需自己建立 |
---|---|
/mnt | /etc/auto.samba |
-
建立自动挂载子策略文件
vim /etc/auto.samba
最终挂载点 | 挂载参数 | 挂载资源 |
---|---|---|
samba | -fstype=cifs,username=haizhizhu,password=haizhizhu | : //192.168.1.10 |
systemctl restart