AutoFS 파일 시스템
 : NFS 여러 문제점을 해결할 수 있는 대안 
  
 -autofs는 클라이언트 시스템 사용자가 자동으로 리모트 파일 시스템을 마운트할 수 있는 기능을 제공하는 파일 시스템 구조이다.
 -automount는 자동 언마운트 제공. 마운트한 파일 시스템을 일정 기간(디폴트600초) 동안 사용하지 않으면 자동 마운트 해제. 
  

  AutoFs 파일 시스템과 맵(Map)
 
  AutOFS 파일 시스템의 맵은
    : automountd 데몬 프로세스와 autofs 모듈이 동작하는데 필요한 정보가 저장된 설정 파일로서, atuomount 명령어에 의해 읽혀진다.
     
    < Map의 세가지 종류>
    (1) master map
      -AutoFs 파일 시스템에서 가장 기준에 되는 맵으로서 다른 맵을 정의하는 용도로 사용하며, 
       /etc/auto_master 파일에 그 내용이 저장되어 있다.
      즉 직접 맵이나 간접 맵의 이름과 포인터를 정의하는 역할 담당.
   
    (2) direct map
    -  맵 내부의 마운트 포인터로 절대 경로명을 사용함.  /etc/auto_direct 파일에 내용이 저장됨
   
    (3) indrect map
    -  맵 내부의 마운트 포인터로 상대 경로명을 사용함.  /etc/auto_home 파일에 내용이 저장됨 
   


실습 (서버, 클라이언트 - 각자 셋팅)


양쪽 : /etc/hosts 에 상대 서버추가



서버

bash-2.05# vi /etc/dfs/dfstab

"/etc/dfs/dfstab" 12 lines, 393 characters

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command '/etc/init.d/nfs.server start' to run the NFS
#       daemon processes and the share commands, after adding the very
#       first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2

share -o ro /usr/share/man
~
~
"/etc/dfs/dfstab" 13 lines, 420 characters

/etc/dfs/dfstab에 share -o ro /usr/share/man 추가

bash-2.05# ps -ef | grep mountd

    root   185     1  0   Dec 12 ?        0:00 /usr/lib/autofs/automountd


bash-2.05# /etc/init.d/nfs.server start
bash-2.05# shareall

nfs 서비스 시작



클라이언트
bash-2.05# man ls

Reformatting page.  Please Wait... done

User Commands                                               ls(1)

NAME
     ls - list contents of directory

SYNOPSIS
     /usr/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file...]

     /usr/xpg4/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file...]

DESCRIPTION
     For each file that is a directory, ls lists the contents  of
     the  directory.  For  each file that is an ordinary file, ls
     repeats its name and any other  information  requested.  The
     output is sorted alphabetically by default. When no argument
     is given, the current  directory  is  listed.  When  several
     arguments   are   given,  the  arguments  are  first  sorted
     appropriately, but file arguments appear before  directories
     and their contents.

     There are three major listing formats.  The  default  format

bash-2.05# mv /usr/share/man /usr/share/men
bash-2.05# man ls

No manual entry for ls.

man 폴더 men으로 바꿔서 없앤 후 없어진 것 확인

bash-2.05# vi /etc/auto_master


"/etc/auto_master" 6 lines, 113 characters

# Master map for automounter

#
+auto_master
/-              auto_direct
/net            -hosts          -nosuid,nobrowse
/home           auto_home       -nobrowse
/xfn            -xfn
~
~
"/etc/auto_master" 7 lines, 129 characters

/etc/auto_master에 /- auto_direct 추가

bash-2.05# vi /etc/auto_direct

"/etc/auto_direct" [New file]
/usr/share/man  server111:/usr/share/man
~
~
~
"/etc/auto_direct" [New file] 1 line, 40 characters

/etc/auto_direct에  /usr/share/man  server111:/usr/share/man  추가

bash-2.05# automount
bash-2.05# man ls

Reformatting page.  Please Wait... done

User Commands                                               ls(1)

NAME
     ls - list contents of directory

SYNOPSIS
     /usr/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file...]

     /usr/xpg4/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file...]

DESCRIPTION
     For each file that is a directory, ls lists the contents  of
     the  directory.  For  each file that is an ordinary file, ls
     repeats its name and any other  information  requested.  The
     output is sorted alphabetically by default. When no argument
     is given, the current  directory  is  listed.  When  several
     arguments   are   given,  the  arguments  are  first  sorted

automount 시작해서 man ls 실행해 보기. 위에서 지정해준 서버의 man에 자동 마운트 되어서 명령어 출력됨.


오토마운트 강제로 끄기
# /etc/init.d/autofs stop
Posted by 딩구르
,