# # AutoFS(Auto File System) # CONTENTS: 0. Introduction 1. AutofsÀÇ °³³ä 2. How Autofs Works 3. "autofs" Command Syntax 4. Autofs¿¡¼­ÀÇ Map 1) Master map 2) Direct Maps 3) Indirect Maps 5. How to Setup Automount Maps 0) Environment 1) Solaris 2.x¿¡¼­ÀÇ automount Set Up 2) Solaris 1.x¿¡¼­ÀÇ automount Set Up 3) Restarting the Automounter on Solaris 2.x 4) Restarting the Automounter on Solaris 1.x 5) Solaris 1.x¿Í 2.x°£ÀÇ automount ºñ±³/Â÷ÀÌÁ¡ 6. ±âŸ 1) Autofs¿¡¼­ÀÇ Metacharacters 2) General Error Messages DESCRIPTION: 0. Introduction * NFS°¡ Sun¿¡¼­ °³¹ßµÇ¾î Áö±ÝÀº »ê¾÷ Ç¥ÁØ(De Facto)È­ ÇÏ¿© ¿©·¯ ¿î¿µÃ¼Á¦¿¡¼­ ä¿ëÇϰųª option module·Î¼­ »ç¿ëÀÚ¿¡°Ô Á¦°øÀÌ µÇ°í ÀÖ´Ù. ±×·¯³ª ÀÌ Autofs ±â´ÉÀº Sun¿¡¼­ ±âÁ¸ÀÇ NFSÀÇ ±â´É¿¡ value addÇÑ °ÍÀ¸·Î¼­ ¿©Å¸ ¾÷ü¿¡¼­ ´Ü¼øÈ÷ NFS ±â´É äÅÿ¡ ¸Ó¹«¸£°í ÀÖ´Â »óȲ¿¡¼­ ÇÑ °ÉÀ½ ´õ ³ª¾Æ°£ °ÍÀ¸·Î, ¿©Å¸ ¾÷üÀÇ NFS »ç¿ëÀÚ¿¡ ºñÇØ SunOS¸¦ »ç¿ëÇÏ´Â »ç¿ëÀÚ´Â ´õ ¸¹Àº »ç¿ë»óÀÇ ÀÌÁ¡À» °¡Áö°í ÀÖ´Â °ÍÀÌ´Ù. * ½ÇÁ¦ AutofsÀÇ ¿©·¯ ±â´ÉÀ» Àû¿ëÇϸé, »ó´çÈ÷ Æí¸®ÇØÁú ¼ö Àִ ȯ°æµéÀÌ ¸¹À½¿¡µµ ºÒ±¸ÇÏ°í, ÀÌÇØÀÇ ºÎÁ·À¸·Î ÀÎÇÏ¿© ½ÇÁ¦ »ç¿ëÀÚµéÀº °ÅÀÇ ÀÌ ±â´É »ç¿ëÀ» Æ÷±âÇÏ°í ÀÖ´Â °æ¿ì°¡ ¸¹À¸¸ç ´õ¿ì±â À̸¦ Áö¿øÇÏ´Â ¿£Áö´Ï¾îµéµµ º° »ý°¢ ¾øÀÌ ÀÌ ±â´É »ç¿ëÀ» Æ÷±âÇÏ°í ÀÖ´Â °ÍÀÌ »ç½ÇÀÌ´Ù. µû¶ó¼­ ³ª¸§´ë·Î ÀÌ·± Á¤¸®°¡ Á» ´õ °¡º­¿î ¸¶À½À¸·Î Autofs¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï Çϴµ¥ µµ¿òÀÌ µÇ¸®¶ó »ý°¢Çϸç À̸¦ ÀÛ¼ºÇÑ´Ù. 1. Autofs ÀÇ °³³ä * Autofs ´Â client systemÀÇ »ç¿ëÀÚ°¡ ÇÊ¿äÇÒ ¶§¿¡ remote systemÀÇ µð·ºÅ丮 ¶Ç´Â file systemÀ» mountÇÏ°í ÇØ´çµÇ´Â mount point¸¦ »ç¿ëÇÏÁö ¾ÊÀ» ¶§´Â ÀÚµ¿À¸·Î unmount ½ÃÅ°´Â ±â´ÉÀ» °¡Áø´Ù. * Autofs´Â NFS¶ó´Â µµ½Ã(city)¿¡¼­ °¡°íÀÚ ÇÏ´Â °÷À̶ó¸é ¾îµð·Îµç ¾È³»ÇØÁÖ´Â ¿îÀü¼ö(chauffeur)ÀÇ ¿ªÇÒÀ» ÇØÁÖ´Â °ÍÀÌ´Ù. Áï NFS¸¦ ±â¹ÝÀ¸·Î ÇÏ¿© À̸¦ Á» ´õ Æí¸®ÇÏ°Ô ÀÌ¿ëÇÒ ¼ö ÀÖ°Ô²û ÇØ ÁÖ´Â Ãß°¡ÀûÀÎ ±â´ÉÀ̶ó ÇÒ ¼ö ÀÖ°Ú´Ù. * Autofs´Â SunOS 4.x¿Í´Â ´Þ¸® SunOS 5.x¿¡¼­ Á¦°øÇÏ´Â »õ·Î¿î typeÀÇ filesytemÀÌ´Ù. ufs, nfs, pcfs, hsfs, cachefs µî°ú °°Àº filesystemÀÇ »õ·Î¿î typeÀÎ °ÍÀÌ´Ù. * Autofs´Â automatic mounting/unmountingÀ» Áö¿øÇÏ´Â kernel file systemÀÌ´Ù. ÁüÀÛÄÁµ¥, Autofs mount pointµéÀ» memoryÀÇ kernel ¿µ¿ª¿¡ ³õ°í °ü¸®ÇÑ´Ù´Â ÀǹÌÀÎ °Í °°´Ù. 2. How Autofs Works * system booting½Ã¿¡ /etc/init.d/autofs(/etc/rc2.d/S74autofs) fileÀ» ½ÇÇàÇÑ´Ù. ±× ³»¿ëÀ» º¸¸é, /usr/lib/autofs/automountd daemonÀ» ±¸µ¿½ÃÅ°¸ç À̾ automount command(/usr/sbin/autofs)¸¦ ¼öÇàÇÑ´Ù. ÀÌ automount ¸í·É¾î´Â master mapÀ» Àаí Autofs mount point¸¦ installÇÑ´Ù. ¿©±â¼­ mount point¸¦ installÇÑ´Ù ÇÔÀº kernel¿¡ Á¸ÀçÇÏ´Â "autofs"¶ó´Â filesystem¿¡ map files(auto_home, auto_master, direct maps, indirect maps)¿¡ ±â·ÏµÈ ³»¿ëÀ» ÀÐ¾î µé¿© ÀÌ¿¡ µû¸¥ mount pointµéÀ» ¹Ì¸® »ý¼ºÇØ ³õ´Â´Ù´Â ÀǹÌ. Áï ÀÌ ´Ü°è¿¡¼± kernel³» "autofs" filesystem¿¡ mount pointµéÀ» »ý¼º¸¸ ÇØ ³õ°í ÀÖÁö ½ÇÁ¦ remote ÂÊÀÇ filesystem/directory¸¦ mountÇÏ°í ÀÖÁö´Â ¾ÊÀº »óÅÂÀÌ´Ù. * automount(/usr/sbin/autofs)´Â mount¿Í´Â ´Þ¸® mountÇϱâ À§ÇÑ filesystem list¸¦ /etc/vfstab¿¡¼­ ãÁö ¾Ê°í map files(auto_home, auto_master, direct maps, indirect maps)¿¡ Á¤ÀÇµÈ ³»¿ëÀ» ÂüÁ¶ÇÑ´Ù. * client·ÎºÎÅÍ "Autofs" mount point¿¡ ÀÖ´Â file system¿¡ ´ëÇÑ access request ¹ß»ý½Ã ´ÙÀ½°ú °°Àº °úÁ¤À» ¼öÇàÇÔ. - autofs°¡ ÀÌ request¸¦ °¡·Îè(intercept). kernelÀÌ °ü¸®ÇÏ´Â filesystemÀÇ typeÀº ¸Å¿ì ´Ù¾çÇÏ´Ù. ½ÇÁ¦ ¾î¶² directory³ª filesystem¿¡ ´ëÇÑ access°¡ ¹ß»ýÇßÀ» ¶§ ±× filesystem typeº°·Î µ¶Æ¯ÇÑ access mechanismµéÀ» kernelÀº ÀÌÇØÇÏ°í ÀÖÀ¸¸é¼­ À̸¦ Áö¿øÇØ ÁØ´Ù. Áï ¸ðµç typeÀÇ filesystemÀ» ÃÑ°ý °ü¸®ÇÏ´Â mechanismÀÌ ÀÖ´Ù°¡ Autofs filesystem ³»¿¡ installµÇÀÖ´Â mount pointµé¿¡ ´ëÇÑ access°¡ ÀÌ·ç¾î Áö´Â °æ¿ì Autofs°¡ À̸¦ ó¸®ÇÏ°Ô²û Á¦¾î¸¦ ³Ñ°Ü Áشٴ Àǹ̷ΠÀÌ °¡·Îæ´Ù´Â °ÍÀ» ÀÌÇØÇÑ´Ù. - Autofs´Â ÀÌ¹Ì ¸Þ¸ð¸®¿¡ ¶° ÀÖ´Â /usr/lib/autofs/automontd¿¡ ÀÌ·¯ÇÑ »óȲ ¹ß»ý message¿Í ÇÔ²² mountµÇµµ·Ï ¿äûµÈ filesystemÀ» Àü´ÞÇÑ´Ù. - /usr/lib/autofs/automountd´Â mountµÇµµ·Ï ¿äûµÈ remote filesystem°ú Autofs¿¡ ÀÌ¹Ì ¸¸µé¾îÁ® ÀÖ´Â mount pointµé Áß ÇØ´çµÇ´Â °Í¿¡ mount¸¦ ½ÇÇàÇÔ. - Autofs´Â °¡·Îë´ø requestÀÇ ¼öÇàÀ» ¸¶Ä¡°í ÀÌÀÇ Á¦¾î¸¦ ´Ù½Ã kernelÀÇ ¸ðµç Á¾·ùÀÇ filesystemÀ» °ü¸®ÇØ ÁÖ´Â mechanismÀ¸·Î µ¹·Á ÁØ´Ù. - Autofs´Â inactivity »óŸ¦ Áö¼ÓÀûÀ¸·Î checkÇÏ¿© ÀÏÁ¤ ½Ã°£(default·Î 5ºÐ)ÀÌ °æ°úµÈ filesystemÀ» ÀÚµ¿À¸·Î umount ½ÃÅ´. ´ÙÀ½Àº /etc/init.d/autofsÀÇ ³»¿ëÀ» ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ÇÔÀ¸·Î¼­ unmount ½Ã°£À» 2ºÐÀ¸·Î Á¶Á¤ÇÑ °æ¿ìÀÓ. two# vi /etc/init.d/autofs 'start') /usr/lib/autofs/automountd > /dev/console 2>&1 # start daemon /usr/sbin/automount -t 2 & # do mounts ;; : :wq! 3. "autofs" Command Syntax * /usr/sbin/automount [ -t mount-timeout ] [ -v ] -t : time ÁöÁ¤ -v : verbose mode * /usr/lib/autofs/automountd [ -Tv ] [ -D name=value ] -T : Trace. Expand each RPC call and display it on the standard output -v : verbose. Log status messages to the console -D : name=vaule : Assign value to the indicated automount map substitution variable. 4. Setting Up Autofs Maps Autofs¿¡´Â ´ÙÀ½°ú °°Àº 3°¡Áö typeÀÇ mapÀÌ Á¸ÀçÇÔ. 1) Master map(auto_master¸¦ ÀǹÌ) * File format: + ---------------------------------------------+ | mount_point map_name [ option ] | + ---------------------------------------------+ - mount_point : directoryÀÇ full(absolute) path nameÀÌ´Ù. ¿©±â ÁöÁ¤µÈ directory°¡ ½ÇÁ¦ Á¸ÀçÄ¡ ¾ÊÀ¸¸é Autofs´Â °¡´ÉÇÑ ÇÑ À̸¦ ¸¸µç´Ù. ¸¸¾à directory°¡ ÀÖÀ¸¸é¼­ ±× ¾Æ·¡ fileµéÀÌ ÀÖ´Ù¸é, mountµÇ¾úÀ» ¶§ ±âÁ¸ÀÇ fileµéÀ» °¨Ãß¾î ¹ö¸°´Ù. - map_name : direct ¶Ç´Â indirect map ÀÇ name - options : map ¿¡ ´ëÇÑ ÀϹÝÀûÀÎ option * Examples: + ---------------------------------------------+ | /- /etc/auto_direct -ro | +----------------------------------------------+ /- : mount pointÀÇ full(absolute) path nameÀÌ direct map "/etc/auto_direct"¿¡ Á¤Àǵǰí ÀÖÀ½À» automounter¿¡°Ô ¾Ë·Á ÁØ´Ù. + ---------------------------------------------+ | /home /etc/auto_home | +----------------------------------------------+ /home : /etc/auto_home¿¡ Á¤ÀÇµÈ ¸ðµç list¿¡ ´ëÇÑ mount ÁöÁ¤À» ÀǹÌÇϸç mapÀº ÀÌ directory ³»¿¡ mountµÇ°Ô µÈ´Ù. ÁÖ·Î user account¸¦ automountÇϴµ¥ »ç¿ë + ---------------------------------------------+ | /net -hosts | +----------------------------------------------+ /net : /etc/hosts database¿¡ ÀÖ´Â hostµéÀÌ shareÇÑ NFS Resources¸¦ /net/host Çü½ÄÀ¸·Î mountÇÒ ¼ö ÀÖ´Ù. »ç¿ë ¿¹) one# share /usr/share/man two# cd /net/one ======> /etc/hosts file¿¡ one systemÀÌ listµÇ¾î ÀÖ¾î¾ß ÇÔ. two# ls ./ ../ usr/ /net/one directory ¹Ø¿¡´Â nfs server oneÀÌ shareÇÑ ¸ðµç resource°¡ ÀÚµ¿À¸·Î mountµÊ. 2) Direct Maps (/etc/auto_direct file À» ÀǹÌ) * File format: +----------------------------------------------+ | Key [options] location | +----------------------------------------------+ - key : mount point ¿¡ °üÇÑ full path name - options : ÁÖ¾îÁø entry¿¡ ´ëÇÑ Æ¯º°ÇÑ option - location : NFS server ¿¡ ÀÇÇØ share µÈ resource ÀÇ file À§Ä¡¸¦ À§¹Ì server:pathname ÀÇ Çü½ÄÀ» ÃëÇÔ. * Example: two# cat /etc/auto_direct /usr/share/man -ro one,three:/usr/share/man À§ÀÇ Çü½ÄÀº nfs serverÀÎ one°ú threeÀÇ /usr/share/manÀÇ nfs resourceµéÀ» twoÀÇ /usr/share/manÀ¸·Î ÀÚµ¿ mountÇÏ°Ú´Ù´Â °ÍÀ» ÀǹÌ. comma¿¡ ÀÇÇØ ºÐ¸®ÇÔÀ¸·Î½á ³×Æ®¿÷»óÀÇ multiple location host¿¡ ´ëÇÑ search¸¦ ¼öÇà, colone ¿À¸¥ÂÊ ½Ã½ºÅÛ ºÎÅÍ searchÇÏ°Ô µÊ. 3) Indirect Maps ´ëºÎºÐÀÇ mapÀº Indirect mapÀ¸·Î ±¸¼ºµÇ¸ç indirect map ³»¿¡ automountÀÇ point¸¦ °¡Áö°í ÀÖÀ½. Indirect mapÀº Ưº°ÇÏ°Ô home directory°°Àº file systemÀÇ accessing¿¡ Æí¸®ÇÔ. * File format: +----------------------------------------------+ | Key [options] location | +----------------------------------------------+ - key : mount pointÀÇ path nameÀ¸·Î /etc/auto_master¿¡¼­ Á¤ÀÇÇÑ pathÀÇ ½ÃÀÛÁ¡ ÀÇ¹Ì - options : ÁÖ¾îÁø entry¿¡ ´ëÇÑ Æ¯º°ÇÑ option - location : NFS resource°¡ À§Ä¡ÇÑ °÷À» ÀǹÌÇÏ¸ç ´ÙÀ½°ú °°Àº formatÀ» °¡Áü. server:pathname * Examples: + ---------------------------------------------+ | * one:/export/home/& | +----------------------------------------------+ * : /etc/auto_master¿¡¼­ Á¤ÀÇÇÑ pathÀÇ ½ÃÀÛÁ¡À¸·Î * optionÀ» »ç¿ëÇÏ¸é ¾î¶°ÇÑ user¶óµµ ÇØ´çµÇ´Â user nameÀ¸·Î nfs server¿¡¼­ shareÇØÁØ /export/home ¹ØÀÇ directory¸¦ ÀÚ½ÅÀÇ home directory·Î mountÇÏ¿© ¾µ ¼ö ÀÖÀ½À» ÀǹÌÇÔ. & : ÀÌ ±âÈ£´Â nfs server°¡ shareÇÑ /export/home directory ¹ØÀÇ ¿©·¯ directory°¡ Á¸Àç½Ã user´Â ƯÁ¤ directory°¡ ¾Æ´Ñ ¾î¶°ÇÑ directory ¶óµµ ÀÚ½ÅÀÇ home directory·Î mount°¡ °¡´ÉÇÔÀ» ÀǹÌ. 5. How to Setup Automount Maps 0) Environment +--------------------------------------------+ | nfs server: hostname : one | | ip address 192.9.200.1 | | OS: SunOS 5.4 | | | | nfs client: hostname : two | | ip address 192.9.200.2 | | OS: SunOS 5.4 | | nfs client: hostname : three | | ip address 192.9.200.3 | | OS: SunOS 4.1.3 | +--------------------------------------------+ 1) Solaris 2.x ¿¡¼­ÀÇ automount Set Up one# share - /usr/disk1 rw "" - /usr/disk2 ro "" - /usr/disk3 root=client "" - /usr/disk4 anon=0 "" two# cat /etc/auto_master # Master map for automounter # #+auto_master /- auto_direct -rw /home auto_home -nosuid /net -hosts -nosuid two# cat /etc/auto_direct /usr/userA -rw one:/usr/disk1 /usr/userB -rw one:/usr/disk2 /usr/userC -rw one:/usr/disk3 /usr/userD -rw one:/usr/disk4 /usr/three -ro three:/usr/man two# cat /etc/auto_home # Home directory map for automounter #+auto_home userA one:/usr/disk1 userB one:/usr/disk2 userC one:/usr/disk3 userD one:/usr/disk4 ===> /etc/auto_homeÀº openwin»óÀÇ admintool¿¡¼­ user account manager¸¦ click ÈÄ ´ÙÀ½°ú °°ÀÌ auto homeÀ» ¼³Á¤ÇÑ´Ù. Edit --> Add user --> pop up µÈ sub window ¿¡ ´ÙÀ½°ú °°ÀÌ ±â·Ï USER IDENTITY User Name: userA User ID: 333 HOME DIRECTORY Path: /usr/disk1 (nfs server ÀÇ share path) Server: one ( nfs server ÀÇ hostname ) AutoHome Setup: V two# /etc/init.d/autofs stop two# /etc/init.d/autofs start two# cd /net/one ===> /etc/hosts ¿¡ µî·ÏµÈ ½Ã½ºÅÛÀÇ share resource ¸¦ ¸ðµÎ °¡Á®¿È two# ls ÃÑ 3 1 ./ 1 ../ 1 usr/ two# cd usr two# ls 1 ./ 2 / 2 disk1/ 2 disk2/ 2 disk3/ 2 disk4/ two# mount |grep net /net/one/usr/disk on one:/usr/disk nosuid/remote on Åä 1¿ù 1 07:55:41 1994 /net/one/usr/disk1 on one:/usr/disk1 nosuid/remote on Åä 1¿ù 1 07:55:41 1994 /net/one/usr/disk2 on one:/usr/disk2 nosuid/remote on Åä 1¿ù 1 07:55:41 1994 /net/one/usr/disk3 on one:/usr/disk3 nosuid/remote on Åä 1¿ù 1 07:55:41 1994 /net/one/usr/disk4 on one:/usr/disk4 nosuid/remote on Åä 1¿ù 1 07:55:41 1994 /net/one/usr/disk5 on one:/usr/disk5 nosuid/remote on Åä 1¿ù 1 07:55:41 1994 two# cd /usr/userA ===> auto_direct ¿¡ µî·ÏµÈ share list ¸¦ °¡Á®¿È two# mount |grep userA /usr/userA on one:/usr/disk read/write/remote on Åä 1¿ù 1 08:01:42 1994 two# touch test_file two# ls ÃÑ 4 2 ./ 2 ../ 0 test_file two# cd /usr/three ===> auto_direct ¿¡ µî·ÏµÈ share list ¸¦ °¡Á®¿È two# ls ÃÑ 190 20 man1/ 4 man4/ 2 man7/ 4 mann/ 2 ./ 8 man2/ 6 man5/ 14 man8/ 2 test/ 2 ../ 120 man3/ 4 man6/ 2 manl/ two# mount |grep three /usr/three on two:/usr/man read only/remote on Åä 1¿ù 1 08:03:46 1994 two# su - userA ===> auto_home ¿¡ µî·ÏµÈ user ÀÇ home account ¸¦ auto mount Sun Microsystems Inc. SunOS 5.4 Generic July 1994 two% ls test_file two% pwd /home/userA two% touch home_userA two% ls home_userA test_file 2) Solaris 1.x ¿¡¼­ÀÇ automount Set Up three# uname -a SunOS core 4.1.3_U1 1 sun4m three# showmount -e one export list for one: /usr/disk1 (everyone) /usr/disk2 (everyone) /usr/disk3 (everyone) /usr/disk4 (everyone) three# cat /etc/auto.master # /etc/auto.master /- /etc/auto.direct /net -hosts -nosuid /home /etc/auto_home -nosuid three# cat /etc/auto.direct # /etc/auto.direct /usr/three -rw,intr one:/usr/disk5 three# cat /etc/auto.home # /etc/auto.home file home one:/usr/disk5 three# cat /etc/passwd |grep userA userA::100:100:autofs home:/home/userA:/bin/csh three# cat /etc/group |grep userA userA:*:100: three# automount -m -f /etc/auto.master three# automount -m /nfs /etc/auto.home three# cd /usr/three ===> auto.direct ¿¡ Á¤ÀÇµÈ one ÀÇ share mount three# pwd /tmp_mnt/usr/three three# touch three three# ls ./ ../ three three# su - userA ===> auto.home ¿¡ Á¤ÀÇµÈ disk ÀÇ account ¸¦ mount three% pwd /tmp_mnt/home/userA three% touch three_home three% ls test_file three# cd /net/one ===> /etc/hosts file ÀÇ one system ¿¡¼­ share ÇÑ ¸ðµç resource mounnt three# pwd /tmp_mnt/net/one three# ls ./ ../ usr/ three# cd usr three# ls ./ ../ disk1/ disk2/ disk3/ disk4/ 3) Restarting the Automounter on Solaris 2.x * ¾ðÁ¦ AutomounterÀÇ RestartingÀ» Çϴ°¡? ÇöÀç ±¸¼ºµÇ¾î ÀÖ´Â /etc/auto_master map, auto_direct, auto_home µîÀÇ mapÀ» ¼öÁ¤ÇßÀ» ¶§¿¡´Â ±âÁ¸¿¡ runningµÇ°í ÀÖ´Â automounter daemonÀ» killing½ÃÅ°°í ´Ù½Ã starting ½ÃÄÑ¾ß º¯°æµÈ ³»¿ëÀÌ automounter¿¡ Àû¿ë µÊ. * ¾î¶»°Ô automounter¸¦ restart ½ÃÅ°´Â°¡? two# /etc/init.d/nfs.client stop two# /etc/init.d/nfs.client start nfs.client script¿¡´Â ÇöÀç runningµÇ°í ÀÖ´Â NFS °ü·Ã daemonÀ» kill ½ÃÅ°´Â stop routine°ú start routineÀÌ µé¾î ÀÖÀ½. 4) Restarting the Automounter on Solaris 1.x three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) three# cd /usr/man three# ls three# pwd /usr/share/man three# cd three# pwd / three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) three# three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three# cat /etc/auto.master /- /etc/auto.direct -nosuid /home /etc/auto.home -nosuid /net -hosts three# cat /etc/auto.direct /usr/man -rw,intr two,one:/usr/share/man <=== two,oneÀÇ ¼ø¼­ ½ÇÁ¦·Î ¿À¸¥ÂÊ¿¡¼­ ¿ÞÂÊÀ¸·Î search ¼ø¼­°¡ µÊ three# ps ax|grep automount 165 p2 S 0:00 grep automount three# man ls No manual entry for ls. three# pwd / three# automount -f /etc/auto.master three# ps ax|grep auto 172 ? S 0:00 automount -f /etc/auto.master 176 p2 S 0:00 grep auto three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three:(pid172) /usr/man ignore ro,intr,port=771,map=/etc/auto.direct,direct 0 0 three:(pid172) /home ignore ro,intr,port=771,map=/etc/auto.home,indirect,dev=8201 0 0 three:(pid172) /net ignore ro,intr,port=771,map=-hosts,indirect,dev=8202 0 0 three# man ls No manual entry for ls. three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) one:/usr/share/man on /tmp_mnt/usr/man type nfs (rw,intr) three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three:(pid172) /usr/man ignore ro,intr,port=771,map=/etc/auto.direct,direct 0 0 three:(pid172) /home ignore ro,intr,port=771,map=/etc/auto.home,indirect,dev=8201 0 0 three:(pid172) /net ignore ro,intr,port=771,map=-hosts,indirect,dev=8202 0 0 one:/usr/share/man /tmp_mnt/usr/man nfs rw,intr,dev=8203 0 0 three# ls -l /usr/man lrwxrwxrwx 1 root 9 Dec 20 14:37 /usr/man -> share/man three# ls -l /usr/share/man lrwxrwxrwx 1 root 20 Dec 20 23:28 /usr/share/man -> /tmp_mnt/usr/man three# ls -l /tmp_mnt/usr/man total 53 drwxr-xr-x 2 sys 11264 Nov 22 17:05 man3n drwxr-xr-x 2 sys 1536 Oct 24 17:48 man3r drwxr-xr-x 2 sys 1536 Oct 24 17:48 man3s drwxr-xr-x 2 sys 1536 Oct 24 17:48 man3t drwxr-xr-x 2 sys 13824 Oct 24 17:48 man3x drwxr-xr-x 2 sys 3072 Oct 24 17:48 man4 drwxr-xr-x 2 sys 512 Oct 24 17:48 man4b drwxr-xr-x 2 sys 1024 Oct 24 17:48 man5 drwxr-xr-x 2 sys 512 Oct 24 17:48 man6 drwxr-xr-x 2 sys 3072 Oct 24 17:49 man7 drwxr-xr-x 2 sys 512 Oct 24 17:49 man9 drwxr-xr-x 2 sys 1024 Oct 24 17:49 man9e drwxr-xr-x 2 sys 8192 Oct 24 17:49 man9f drwxr-xr-x 2 sys 1024 Oct 24 17:49 man9s drwxr-xr-x 2 sys 512 Oct 24 17:50 manl drwxr-xr-x 2 sys 512 Oct 24 17:50 mann three# rlogin two Last login: Wed Dec 20 23:07:40 from one Sun Microsystems Inc. SunOS 5.4 Generic July 1994 You have mail. two# man ls Reformatting page. Wait... done ^Ctwo# two# uname -a SunOS two 5.4 generic sun4c sparc two# share - /export/home/disk1 rw "home dirs" - /export/home/disk2 rw "home dirs" - /usr/share/man rw "" two# two# exit Connection closed. three# three# vi /etc/auto.direct three# cat /etc/auto.direct /usr/man -rw,intr one,two:/usr/share/man <=== two,oneÀ» one,two·Î º¯°æ three# ps ax|grep automount 172 ? I 0:00 automount -f /etc/auto.master 190 p2 S 0:00 grep automount three# pwd / three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) one:/usr/share/man on /tmp_mnt/usr/man type nfs (rw,intr) three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three:(pid172) /usr/man ignore ro,intr,port=771,map=/etc/auto.direct,direct 0 0 three:(pid172) /home ignore ro,intr,port=771,map=/etc/auto.home,indirect,dev=8201 0 0 three:(pid172) /net ignore ro,intr,port=771,map=-hosts,indirect,dev=8202 0 0 one:/usr/share/man /tmp_mnt/usr/man nfs rw,intr,dev=8203 0 0 three# kill -15 172 <=== SIGTERM signal SIGKILL(Number 9) signalÀ» »ç¿ëÇؼ± °áÄÚ ¾ÈµÊ. three# ps ax|grep auto 196 p2 S 0:00 grep auto three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three:(pid172) /usr/man ignore ro,intr,port=771,map=/etc/auto.direct,direct 0 0 three# umount /usr/man ^Cthree# three# three# automount -m -f /etc/auto.master NFS server (pid172@/usr/man) not responding still trying ^Cthree# three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three:(pid172) /usr/man ignore ro,intr,port=771,map=/etc/auto.direct,direct 0 0 three# mount /dev/sd0a on / type 4.2 (rw) /dev/sd0g on /usr type 4.2 (rw) three# vi /etc/mtab three# cat /etc/mtab /dev/sd0a / 4.2 rw,dev=0700 1 1 /dev/sd0g /usr 4.2 rw,dev=0706 1 2 three# automount -m -f /etc/auto.master ^Cthree# 5) Solaris 1.x¿Í 2.x°£ÀÇ automount ºñ±³/Â÷ÀÌÁ¡ ------------------------------------------------------------------------------- 1.x 2.x ------------------------------------------------------------------------------- filesystem Autofs ------------------------------------------------------------------------------- daemon /usr/sbin/automount /usr/lib/autofs/automountd /usr/sbin/autofs ------------------------------------------------------------------------------- weight ¾øÀ½ ÀÖÀ½ ------------------------------------------------------------------------------- reinit "# kill -15(SIGTERM) /etc/init.d/autofs stop/start " ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- 6. ±âŸ 1) Autofs¿¡¼­ÀÇ Metacharacters * Plus sign (+) + sign Àº NIS+ ¸¦ »ç¿ëÇÏ¿© automount ¸¦ ÇÏ°Ú´Ù´Â °ÍÀ» ÀǹÌÇÑ´Ù. Example: two# more /etc/auto_master # Home directory map for automounter +auto_home userA one:/export/home/app1 * Asterisk (*) and Ampersand (&) ´ÙÀ½°ú °°Àº map À» ±¸¼ºÇß´Ù°í °¡Á¤ÇÒ ¶§ +-------------------------+ | * one:/export/home/& | +-------------------------+ À§¿¡ ³ª¿À´Â *´Â substituted value·Î¼­ ¾î¶°ÇÑ Key°¡ ÁÖ¾îÁ®µµ ¸ðµÎ ¼öÇàÇÑ´Ù´Â °ÍÀ» ÀǹÌÇÏ¸ç µÚ¿¡ ³ª¿À´Â & ±âÈ£´Â home directory »ó¿¡ ÀνĵǴ ¸ðµç directoryµéÀ» automountÇÑ´Ù´Â ÀǹÌÀÌ´Ù. ÇÏ°Ú´Ù´Â Àǹ̰¡ µÈ´Ù. Example: NFS server: one ( 192.9.200.1) NFS client: two ( 192.9.200.2) one# cd /export/home one# mkdir app2 app2 one# share /export/home two# tail -2 /etc/passwd userA:x:101:200:autofs home1:/home/app1:/bin/csh userB:x:102:200:autofs home2:/home/app2:/bin/csh two# cat /etc/auto_master # Master map for automounter #+auto_master /- auto_direct /net -hosts -nosuid /home auto_home two# cat /etc/auto_home # Home directory map for automounter #+auto_home * one:/export/home/& two# dfshares one RESOURCE SERVER ACCESS TRANSPORT one:/usr/disk1 one - - one:/usr/disk2 one - - one:/usr/disk3 one - - one:/usr/disk4 one - - one:/export/home one - - two# su - userA Sun Microsystems Inc. SunOS 5.4 Generic July 1994 two% pwd /home/app1 two% touch two_file touch: two_file cannot create + -------------------------------------------------------------+ | MOUNT REQUEST : name=app1 map=auto_home opts=rw path=/home | | MOUNT REPLY : status=0 | | MOUNT: Command not found | +--------------------------------------------------------------+ ===> two system ÀÇ console ¿¡ À§ÀÇ message °¡ Ãâ·ÂµÇ¸é¼­ autofs ÀÇ »óŸ¦ ³ªÅ¸³» ÁØ´Ù. À̵é option À» »ìÆ캸¸é - name : /etc/passwd file¿¡¼­ ÁöÁ¤µÈ »ç¿ëÀÚÀÇ home directory¸¦ ÀÇ¹Ì - map : »ç¿ëÇÏ´Â mapÀÇ Á¾·ù ±â¼ú - opts : ¾î¶°ÇÑ optionÀ¸·Î automount¸¦ ÇÏ¿´´ÂÁöÀÇ »çÇ× - path : map file¿¡¼­ ÁöÁ¤µÈ mount °æ·Î¸íÀÌ ±â¼úµÊ - status: status=0´Â success¸¦ ÀǹÌÇÏ°í status=2´Â failÀ» ÀÇ¹Ì two% exit two% logout +----------------------------+ | UNMOUNT REQUEST: | | dev=24c0015 indirect | | UNMOUNT REPLY : status=0 | +----------------------------+ 2) General Error Messages note: ¾Æ·¡¿¡ ³ª¿À´Â message µéÀ» ÀÚ¼¼È÷ º¸±â À§Çؼ­´Â ´ÙÀ½°ú °°ÀÌ autofs file ¿¡¼­ verbose mode(-v) ¿Í Trace (-T)¸¦ editing Çؼ­ ³Ö¾îÁØ´Ù. error ¶Ç´Â ÀϹÝÀûÀÎ message ´Â console »ó¿¡ ³ªÅ¸³­´Ù. two# vi /etc/init.d/autofs 'start') /usr/lib/autofs/automountd -Tv > /dev/console 2>&1 # start daemon /usr/sbin/automount -t 1& # do mounts ;; * map name, key key: bad .The map entry is mailformed, and Autofs cannot interpret it. Recheck the entry; perhaps there are characters in it that need escaping. * host server not responding . Autofs attempted to contact but received no response. * Mount of server:pathname on mountpoint:reason . Autofs failed to do a mount. This may indicate a server or network problem * pathconf: server: server not responding. . Autofs failed to get path conf information for pathname. * hierarchical mountpoints: pathname1 and pathname2 . Autofs does not allow its mountpoints to have a hierarchical relationship ( i.e. automounted file system.) * mountpoint: Not a directory . Autofs cannot mount itself on mountpoint because it's not a directory. Check the spelling and path name of the mount point. * dir mountpoint must start with '/' . Automount mount point must be given as full path name. Check the spelling and path name of the mount point. * mapname: nis_err . Error in looking up an entry in an NIS map. May indicates a server or network problem. * hostname:exports:rpc_err . Error getting export list from hostname. This indicates a server or network problem. * nfscast: cannot send packet: reason . Autofs cannot send a query packet to a server in a list of replicated file system locations * nfscast: cannot receive reply: reason . Autofs cannot receive replies from any of the servers in a list of replicated file system locations. * nfscast: select: reason ; Cannot create socket for nfs: rpc_err . All these error messages indicate problems attempting to ping servers for a replicated file system. This may indicate a network problem