zoukankan      html  css  js  c++  java
  • automount

    Automoun is another kind of NFS. The different is that in NFS mode the client need to connect to NFS server all the time. This will consume server resources making the server slow. But in automount mode, client dont have to connect to server all the time. When you access the nfs resource, the automount will run and mount the server resource. When you do not need the nfs resource, the automount will disconnect after some time.

    Here is the steps to setup automount.

    1. We have a nfs server. Which is sharing a directory. The server configure is the same as normal NFS server setting.

    edit /etc/export content so that the server know which diretory to share and who can use the mount

    1 [root@racnode1 temp]# cat /etc/exports
    2 /opt/temp racnode2

    start NFS service

     1 [root@racnode1 temp]# service nfs start
     2 Starting NFS services:  exportfs: No options for /opt/temp racnode2: suggest racnode2(sync) to avoid warning
     3                                                            [  OK  ]
     4 Starting NFS mountd:                                       [  OK  ]
     5 Stopping RPC idmapd:                                       [  OK  ]
     6 Starting RPC idmapd:                                       [  OK  ]
     7 Starting NFS daemon:                                       [  OK  ]
     8 [root@racnode1 temp]#
     9 [root@racnode1 temp]# showmount -e
    10 Export list for racnode1:

    2. do setting on client

    edit /etc/auto.master which is the main mapping file. Autofs will mornitor the /opt/TempOnNode2. When access this directory, autofs will check the /etc/auto.home file to decide how to manage this mountpoint. When the directory is idle for 28second, It will automaticall umount.

    1 [root@racnode2 opt]# cat /etc/auto.master
    2 /opt/TempOnNode2      /etc/auto.home  --timeout=28

    Now edit /etc/auto.home.

    1 [root@racnode2 opt]# cat /etc/auto.home
    2 * -rw,no_root_squash,soft,intr 192.168.3.161:/opt/temp/&

    Ok. Then we can startup the autofs service

    1 [root@racnode2 TempOnNode2]# service  autofs start
    2 Starting automount:                                        [  OK  ]

    Then try to access /opt/TempOnNode2

    [root@racnode2 dir1]# pwd
    /opt/TempOnNode2/dir1
    [root@racnode2 dir1]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_itiappgw1-lv_root
                           16G   15G   42M 100% /
    tmpfs                1004M     0 1004M   0% /dev/shm
    /dev/sda1             485M   31M  429M   7% /boot
    192.168.3.161:/opt/temp/dir1
                           16G   15G   11M 100% /opt/TempOnNode2/dir1
    [root@racnode2 dir1]#

    You can see once we get into the directory /opt/TempOnNode2/dir1. The automount works and you can see the directory will umount after 28second.

  • 相关阅读:
    zabbix 对/etc/ssh/sshd_config文件的监控 但status为unknowen
    Kotlin从零到精通Android开发
    谷歌官方 构建您的第一个应用 Kotlin版
    android studio 运行按钮为灰色的解决办法之一
    webapi发布到windows 2012的iis8里 出错
    Asp.net MVC WebApi项目的自动接口文档及测试功能打开方法
    Asp.net Web Api开发(第四篇)Help Page配置和扩展
    关于SNMP的MIB文件的语法简述
    Visual Stdio 2017增加SVN支持
    ffmpeg 多个音频合并 截取 拆分
  • 原文地址:https://www.cnblogs.com/kramer/p/3007122.html
Copyright © 2011-2022 走看看