• autofs 自动挂载.


    autofs 自动挂载.

    操作环境:redhat 6

    一、autofs 说明

    自动挂载器是一个监视目录的守护进程,并在目标子目录被引用时,自动执行预定义的挂载

    自动挂载器由autofs服务脚本管理

    自动挂载器由auto.master配置文件进行配置,该文件引用了一个按惯例称作/etc/auto.misc

    二、安装autofs

    [root@Alex01 home]# yum install autofs

    三、配置autofs

    [root@Alex01 home]# rpm -qc autofs

    [root@Alex01 home]# vim /etc/auto.master

    /misc是定义的自动mount的挂载点, /etc/auto.misc里定义了mount的动作.

    当然里的/misc可以自定义

    [root@Alex01 home]# vim /etc/auto.misc

    /dev/sde 分区挂载到 /misc/sde_test目录里面去

    # 这些/misc/sde目录,都不需要自己去创建,启动autofs时会自动创建,

    ps: 

    挂载samba的配置: 

    # backup      -fstype=cifs,username=smbuser1%asdf     ://192.168.1.99/pub

     

    挂载iso的配置: 

    # iso       -loop,fstype=iso9660,ro       :/root/rhel-server-6.0-x86_64-boot.iso

    挂载nfs的配置:

    nfs        -fstype=nfs            192.168.1.99:/test_nfs

    [plain] view plaincopy
     
    1. [root@Alex01 misc]# /etc/init.d/autofs reload             # 重启载入配置文件  
    2.   
    3. [root@Alex01 misc]# ll                                    # 然后在/misc目录里面什么文件也没有,这时,其实已经载入成功,只是文件夹没有显示,  
    4. 总用量 0  
    5.   
    6. [root@Alex01 misc]# cd sde_test                           #  只有手动cd sde_test 进入这个文件夹后,才会在/misc文件夹下面显示  
    7.   
    8. [root@Alex01 misc]# ll  
    9.   
    10. drwxrwxrwx. 2 root root 4096  8月 20 19:45 sde_test       # 现在就有了.  



    # 如果上时间不进入,就会自动断开,默认是300秒.

    # 在/etc/sysconfig/autofs配置.

  • 相关阅读:
    Java集合的Stack、Queue、Map的遍历
    LinkedHashMap的实现原理
    HashSet的实现原理
    HashMap的实现原理
    leetcode526
    leetcode406
    leetcode413
    leetcode513
    leetcode338
    leetcode419
  • 原文地址:https://www.cnblogs.com/L-H-R-X-hehe/p/3789518.html
Copyright © 2020-2023  润新知