autofs自动挂载

目标

  使用autofs自动挂载网络共享存储

实操演示

  • 准备工作
[root@sinfotek vdo]# yum install autofs
[root@sinfotek vdo]# systemctl enable autofs
Created symlink /etc/systemd/system/multi-user.target.wants/autofs.service → /usr/lib/systemd/system/autofs.service.
  • 创建配置文件
[root@sinfotek auto.master.d]# cat /etc/auto.master.d/nfs.autofs
/home /etc/auto.testnfs
[root@sinfotek auto.master.d]# cat /etc/auto.testnfs 
share -rw,sync 192.168.1.116:/home/share
##创建配置文件,使用相对路径进行配置

[root@sinfotek auto.master.d]# cat nfs.autofs 
/- /etc/auto.testnfs
[root@sinfotek auto.master.d]# cat /etc/auto.testnfs 
/home/share -rw,sync 192.168.1.116:/home/share
[root@sinfotek auto.master.d]# cd /home/share
[root@sinfotek share]# ls
IMG_0318.MP4
##创建配置文件,使用绝对路径进行配置。
##目录在使用时zi'dong'gua'z
文档更新时间: 2022-11-16 11:26   作者:xiubao yan