autofs 自动挂载

将 172.16.30.254://mnt/public 挂载到 /aaa/auto, 一开始不用创建/aaa/auto, 等访问时自动创建

[root@station ~]# yum install -y autofs.x86_64 

[root@station ~]# vim /etc/auto.master
添加     /aaa    /etc/auto.misc          ------ 访问/aaa时自动读取配置文件

[root@station ~]# vim /etc/auto.misc 

添加 auto            -fstype=nfs             172.16.30.254://mnt/public         ------ 将文件夹挂载到auto

[root@station ~]# systemctl enable autofs.service          ------ 启动autofs 服务
ln -s '/usr/lib/systemd/system/autofs.service' '/etc/systemd/system/multi-user.target.wants/autofs.service'
[root@station ~]# systemctl start autofs.service 
[root@station ~]# ls  ----- 一开始没有aaa目录
anaconda-ks.cfg  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  passwd  Pictures  Public  Templates  Videos
[root@station ~]# cd /aaa      ----- 访问时自动创建
[root@station aaa]# ls           ------- 还没有auto
[root@station aaa]# cd auto    ----- 访问时自动创建并挂载
[root@station auto]# ls           ------- 挂载的文件
ddd  mmm  test_public_file
 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值