\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{Automount mini-Howto µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½}
\author{{\ttfamily don@sabotage.org}}
\date{v0.3, 22 October 1998}
\abstract{Õâ·ÝÎÄ¼þÔÚÃèÊö×Ô¶¯µµ°¸ÏµÍ³µÄ×Ô¶¯¹ÒÔØ³ÌÊ½£¬ÈçºÎÉè¶¨²¢Ö¸³öÒ»Ð©Ó¦¸Ã±ÜÃâµÄÎÊÌâ¡£}


\begin{document}
\maketitle
\tableofcontents

\section{¼ò½é}


\subsection{µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ - ÊÇÊ²÷á¼°ÎªÊ²÷á}

µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØÊÇÒ»¸ö¿ÉÕë¶ÔÌØ¶¨µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ(Ð¶ÔØ)µµ°¸ÏµÍ³µÄ daemon¡£
¼ÙÈçµµ°¸ÏµÍ³ÒÑ¾­Ð¶ÏÂÁË£¬¶øÒ»¸öÊ¹ÓÃÕß³¢ÊÔÈ¥Ê¹ÓÃËü£¬
ÄÇ÷áµµ°¸ÏµÍ³»á×Ô¶¯µÄÔÙ¹ÒÔØÉÏÈ¥¡£ÕâÔÚ´óÐÍµÄÍøÂ·»·¾³Àï£¬
ÒÔ¼°Ò»Ð©ÔÚ»úÆ÷Ö®¼äÏà»¥¹ÒÔØµµ°¸ÏµÍ³µÄÊ±ºòÌØ±ðÓÐÓÃ (ÓÈÆäÊÇÄÇÐ©²»ÊÇÒ»Ö±¿ª»úµÄ»úÆ÷)¡£
¶ÔÒ»Ð©¿ÉÒÆÊ½µÄ×°ÖÃ»òÒ»Ð©ÆäËûÓÃÍ¾¶¼ºÜÓÐÓÃ£¬ÏñÊÇ¿ÉÒÔºÜÈÝÒ×µÄÔÚ DOS µµ°¸ÏµÍ³ÉÏ×öÒ»Ð©Ç¿ÖÆµÄ ascii µÄ×ª»»¡£




\subsection{µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½µÄÖÖÀà}

ÔÚ Linux ÉÏÓÐÁ½ÖÖµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½; {\itshape AMD\/} ºÍ {\itshape autofs\/}¡£
AMD ÊÇµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½µÄ daemon £¬¶øÇÒ¹¦ÄÜ¾ÍÏñ SunOS ÉÏµÄ AMD Ò»Ñù¡£ËüÊÇÔÚ User space ÖÐÊµ×÷µÄ£¬¾ÍÊÇËµËü²»ÊÇºËÐÄµÄÒ»²¿·Ý¡£
ËüÒ²²»ÐèÒªºËÐÄÖªµÀµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØÊÇÔõ÷áÒ»»ØÊÂ£¬¼ÙÈçÄãÓÃ NFS ¹ÒÉÏ±¾»úµÄµµ°¸ÏµÍ³£¬Í¸¹ý AMD £¬
Ëü°ïÄã´¦ÀíÁËËùÓÐÍ¸¹ý NFS ÏµÍ³µÄµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØÊ±µÄÍøÂ·Ñ¶Ï¢½»»»¡£
Autofs ÊÇÒ»¸öÓÃÒÔ¸¨ÖúºËÐÄµÄÐÂÏµÍ³£¬Ò²¾ÍÊÇËµºËÐÄµÄµµ°¸ÏµÍ³³ÌÊ½ÂëÖªµÀ×Ô¶¯¹ÒÔØµãÔÚÄÄ£¬
ÒÔ¼°Ëüµ×²ãËùÊ¹ÓÃµÄµµ°¸ÏµÍ³ÊÇÊ²÷á£¬È»áá×Ô¶¯¹ÒÔØ³ÌÊ½±ã¿ÉÒÔ¿ªÊ¼ÔË×÷¡£
ÔÚÕâ·ÝÎÄ¼þÖÐÖ»»áÌ¸µ½ autofs¡£




\section{°²×°}

ÒòÎª autofs ÊÇÊµ×÷ÔÚºËÐÄ¿Õ¼ä£¬ÄãµÄºËÐÄÒ»¶¨Òª¼ÓÈë autofs Ö§Ô®¡£ÔÚ 2.0.xx °æ£¬Ëü»¹ÊÇÒ»¸öÊµÑéÐÔÑ¡Ïî£¬µ«ÊÇÒÑ¾­Ïàµ±ÎÈ¶¨¡£
ÔÚ°æ±¾ 2.1.xx (ºÍ 2.2.xx) ¾Í²»ÔÙÊÇÊµÑéÐÔµÄÁË¡£



µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½ºÍËüµÄÉè¶¨µµ¶¼ÊÇ±Ø±¸µÄ£¬ÓÃ rpms (ÔÚ RedHat Àï£¬ÊÇ°²×°µÄÒ»²¿·Ý) ÊÇºÜºÃµÄ·½·¨¡£
µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½Ó¦¸ÃÓÉ {\ttfamily /etc/rc.d/init.d} Ä¿Â¼ÏÂµÄ£Ò£ÃµµÆô¶¯¡£
rpm »áÌæÄã°²×°ÕâÐ©³ÌÊ½¼°Éè¶¨µµ£¬µ«ÊÇÄãÓ¦¸ÃÈ¥È·¶¨Ëü±»Æô¶¯ÁËÃ»£¬²»¹ÜÊÇÓÃ 
RedHat µÄ control-panel »òÊÇÆäËû Linux Ì×¼þµÄÈÎºÎ·½Ê½¡£
·Ç rpm µÄÌ×¼þÒ²»áÓÐÊÊºÏËûÃÇ×Ô¼ºÏµÍ³µÄÄÇÒ»Ì×¡£
¼ÙÈçÄãÕýÔÚ¶ÁÕâ·ÝÎÄ¼þ£¬±íÊ¾Äã¿ÉÄÜ²»ÏëÖªµÀ rc ×öÐ©Ê²÷á£¬ËùÒÔ²»±Ø»¨Ì«¶à¹¦·òÔÚ
ÑÐ¾¿ rc ÃèÊöµµÔÚ×öÐ©Ê²÷áÊÂ¡£




\section{Éè¶¨}

ÀûÓÃ RPM °²×° autofs ½«»áºÜÇáËÉµØ°ÑÄã´øµ½Õâ¸ö²½Öè£¬
µ«ÊÇÏÖÔÚµÄÕâ¸ö²¿·ÖÄã¿ÉÄÜÎÞ·¨È·¶¨ÄãÊÇ·ñÔø¾­×ö¹ý¡£



ÔÚ /etc ÏÂÃæÓÐÁ½¸öµµ°¸£¬Ò»¸öÊÇ {\ttfamily auto.master} ¶øÁíÍâÒ»¸öÊÇ {\ttfamily auto.misc} ¡£
ÎÒµÄ auto.master ¿´ÆðÀ´ÏñÕâÑù:
\begin{verbatim}
/auto   /etc/auto.misc  --timeout 60
\end{verbatim}


µÚÒ»¸öÀ¸Î»²»ÊÇ¹ÒÔØµã£¬ËüÊÇ¹ÒÔØµãµÄ¼¯ºÏ£¨ÔÚµÚ¶þ¸öÀ¸Î»¿ÉÒÔÕÒµ½£©ËùÔÚµÄµØ·½¡£
µÚÈý¸öÑ¡ÏîÊÇËµ×Ô¶¯¹ÒÔØµÄµµ°¸ÏµÍ³ÔÚÊ¹ÓÃááµÄ 60 Ãëáá»áÊÔÖøÐ¶ÔØÏÂÀ´¡£
µ±È»£¬Èç¹ûÕýÔÚÊ¹ÓÃÖÐÊÇ²»ÄÜÐ¶ÏÂµÄ¡£

Auto.misc ÊÇÒ»¸ö ¡°Ó³Éäµµ¡°¡£ ¶à¸öÓ³Éäµµ¿ÉÒÔÔÚ auto.master ÖÐ±»¶¨Òå¡£
ÎÒµÄ auto.misc ¿´ÆðÀ´ÏñÊÇÕâÑù:
\begin{verbatim}
kernel          -ro,soft,intr           ftp.kernel.org:/pub/linux
cd              -fstype=iso9660,ro      :/dev/cdrom
zip             -fstype=auto            :/dev/hdd4
floppy          -fstype=vfat            :/dev/fd0
\end{verbatim}


µÚÒ»¸öÀ¸Î»ÊÇ¹ÒÔØµã¡£ÔÚÕâ¸öÀý×ÓËü¿ÉÄÜÊÇ /auto/floppy Ê²÷áµÄ¡£ÖÐ¼äÀ¸Î»ÊÇÑ¡Ïî£»
Äã¿ÉÒÔÔÚ mount µÄÏßÉÏÊ¹ÓÃËµÃ÷ÖÐÕÒµ½Ïà¹ØµÄ×ÊÑ¶¡£×îááÒ»¸öÀ¸Î»Ö¸³öµµ°¸ÏµÍ³µÄÀ´Ô´¡£
Ð´Öø "kernel" µÄÄÇÒ»ÐÐ±íÊ¾ÓÃ NFS À´¹ÒÔØµµ°¸ÏµÍ³¡£ÆäËûÐÐµÄÃ°ºÅ±íÊ¾ÕâÊÇ±¾»úµÄ×°ÖÃ¡£




\section{µÈ´ýÐ¶ÏÂµµ°¸ÏµÍ³¿ÉÕæÊÇÂþ³¤}

ÓÐÐ©ÈË¿ÉÄÜÑÛÕöÕöµÈÖø 60 ÃëµÄ timeout Ê±¼äµ½²¢ÇÒÏëÖø{\itshape  
Èç¹ûÒªÍË³ö´ÅÆ¬Õâ¿ÉÕæÊÇÌ«¾ÃÁË.. 
Ò²ÐíÎÒ¿ÉÒÔÖ±½Ó¶Ô´ÅµúÏÂ sync È»ááÄÃ³ö´ÅÆ¬¶øÇÒÃ»ÓÐÈË»á×¢Òâµ½¡£\/}
ÈÃÎÒÀ´½¨ÒéÒ»¸ö {\ttfamily ±È½ÏÀíÖÇµÄÌæ´ú·½°¸}¡£
Ê×ÏÈÄØ£¬Äã¿ÉÒÔ¸Ä±ä timeout µÄÖµ£¬µ«ÊÇÔÚÊ¹ÓÃááµÄ15Ãë»òÆäËûÃëÊý¾ÍÈÃÏµÍ³Ð¶ÏÂµµ°¸ÏµÍ³
ËÆºõÓÐµãÃ»Ð§ÂÊ¡£
Êµ¼ÊÉÏÓÐÒ»¸ö·½·¨¿ÉÒÔÈÃµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½Ð¶ÏÂµµ°¸ÏµÍ³¡£Èç¹ûÄãËÍÒ»¸ö(ÓÃ kill ³ÌÊ½) Ñ¶ºÅ {\ttfamily SIGUSR1} ¸øµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÐò£¬
Ëü»áÐ¶ÏÂÈÎºÎËü¿ÉÒÔÐ¶ÏÂµÄ¡£µ«ÊÇÈËÃÇ¿ªÊ¼ÔÚËûÃÇµÄÊÓ´°¹ÜÀí³ÌÊ½ÉÏ×öÒ»¸öÐ¶ÏÂµµ°¸ÏµÍ³µÄ°´Å¥Ö®Ç°£¬»¹ÓÐÒ»¸öÐ¡ÎÊÌâ¡£

µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÐòÊÇ±» root ËùÖ´ÐÐµÄ£¬ËùÒÔËüÖ»ÄÜ½ÓÊÜ root µÄÑ¶ºÅ¡£
ÄãÏëÓÃµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½¿ÉÄÜÓÐ°ëÊýÒÔÉÏµÄÀíÓÉÊÇÒòÎªÄã²»ÊÇÏµÍ³¹ÜÀíÔ±È´ÏëÒª
¹ÒÈëºÍÐ¶ÏÂµµ°¸ÏµÍ³¡£
Ð´Ò»¸ö¿ÉÒÔÉè¶¨Ê¹ÓÃÕßÉí·ÝÊ¶±ðÂëµÄ£Ã³ÌÊ½¿ÉÒÔÇáÒ×´ï³É£¬µ«ÕâÑùµÄ·½·¨²¢²»ºÃ¡£
²»¹ÜÔõÑù£¬½åÓÉ sudo ³ÌÊ½Ò²¿ÉÒÔÔÊÐíÊ¹ÓÃÕßËÍ³öÒ»Ð©ÊÊµ±µÄ kill Ñ¶ºÅ¡£
Î¨Ò»µÄÎÊÌâÊÇ sudo ²¢²»ÔÊÐíÄãÒÔ ` À´Ö´ÐÐ´ÎÃüÁî£¬ËùÒÔÄã±ØÐë×Ô¼ºÕÒ³ö autofs µÄ
³ÌÐòÊ¶±ðÂë¡£
ÄãÓ¦¸ÃÓÐÒ»¸ö³ÌÊ½½Ð×ö killall£¬Õâ¿ÉÒÔÈÃÄã×öµ½ÕâÐ©: (ÐÒºÃÓÐÕâÐ©¸ö½¨Òé)

\begin{verbatim}
ALL     ALL=NOPASSWD:/usr/bin/killall -USR1 automount
\end{verbatim}

·ñÔò£¬ÄãÒªÔÊÐíÄãµÄÊ¹ÓÃÕßËÍ -SIGUSR1 ¸øËùÓÐµÄ³ÌÐò¡£
Õâ¶ÔÒ»Ð©³ÌÊ½ÓÐ²»Í¬µÄÓ°Ïì£»Ëü¿ÉÄÜ»áÊ¹Ä³Ð©ÊÓ´°¹ÜÀíÆ÷ÖØÐÂÆô¶¯£¬¶øÇÒÖÕÖ¹ xemacs¡£
ËùÒÔÔÚÕâ¶ùÏ£Íû killall Ã»ÓÐ»º³åÇøÒç³öµÄÎÊÌâ...




\section{ÎÊÌâ}






\subsection{ÎÒÕÒ²»µ½ /auto/floppy £¬»òÈÎºÎÎÒÒªÕÒµÄ¹ÒÔØµã¡£}

Èç¹û automount ÕýÈ·µÄ°²×°£¬¼´Ê¹Ã»ÓÃµ½Ê±¿´²»µ½ÕâÐ©¹ÒÔØµã£¬µ±ÄãÊÔÖøÓÃËüÊ±£¬ÈÎºÎÄãÒª
µÄ¹ÒÔØµã¶¼»áÔÚÄÇ¶ù¡£
Èç¹ûÄãÓÃÍ¼ÐÎ½çÃæµÄÄ¿Â¼ä¯ÀÀ³ÌÊ½£¬Äã¿ÉÄÜÒªÊÖ¶¯´òÈë¹ÒÔØµãµÄÃû×Ö¡£
²»ÐÒµÄÊÇ£¬ÎÞ·¨´Ó¿´²»¼ûµÄÕâÐ©¹ÒÔØµãÖÐÑ¡³öËùÒªÓÃµÄ£¬ÕýÊÇ autofs µÄÖ÷ÒªÈ±µã¡£
Èç¹ûÕâÔì³ÉÄãµÄÎÊÌâ£¬È¥±à¼­Éè¶¨µµ°¸¡£
(ÌáÊ¾£¬¾ÍÊÇÄÇÐ©½áÎ²ÊÇ .c µÄµµ)




\subsection{ÎÒÔõ÷á¿´µ½ÒÑ¾­¹ÒÔØÄÄÐ©¶«Î÷£¿}

ÓÃ {\ttfamily df} ÃüÁî¡£ {\ttfamily mount} ²»¼ÓÈÎºÎµÄÑ¡ÏîÒ²ÓÐÍ¬ÑùµÄ¹¦ÄÜ£¬²¢ÇÒÐã³öËüËù¹ÒÉÏµÄÒ»Ð©Ñ¡Ïî¡£




\subsection{ÎÒ·Å½øÒ»Æ¬ win95 µÄ´ÅÆ¬ ("vfat") ¶øËüÈ´×Ô¶¯Õì²âµ½ËüÖ»ÊÇÒ»Æ¬Ò»°ãµÄ FAT ´ÅÆ¬¡£}

Õâ²»ÊÇµµ°¸ÏµÍ³×Ô¶¯¹ÒÔØ³ÌÊ½µÄÎÊÌâ¡£µ±Õâ·ÝÎÄ¼þÕýÔÚÐ´µÄÊ±ºò£¬
"auto" ÕâÖÖµµ°¸ÖÖÀàÔÚ³É¹¦µÄ¹ÒÔØÒ»¸ö msdos µµ°¸ÏµÍ³Ö®Ç°²¢²»»á³¢ÊÔ vfat µÄ¹ÒÔØ¡£
VFAT ¾ÍÊÇ°Ñ Win95 ºÍ WinNT µÄ³¤µµÃû¼·½ø FAT/MSDOS µµ°¸ÏµÍ³¡£



¸ù¾Ý mount µÄÆäÖÐÒ»¸ö×÷ÕßËµ£¬ÒòÎª mount Ö»ÊÇ°ü×°ÁËÒ»¸ö±ØÐëÖ¸¶¨µµ°¸ÏµÍ³ÖÖÀàµÄÏµÍ³ºô½Ð£¬
°Ñµµ°¸ÏµÍ³ÖÖÀàÅªÇå³þÈÔÈ»ÊÇÊ¹ÓÃÕßµÄÔðÈÎ¡£
ÈÃ mount ÕÕÖøÁÐ±íµÄË³Ðò£¬È¥Ò»ÖÖÒ»ÖÖµÄµµ°¸ÏµÍ³È¥ÊÔ£¬¶ø²»ÊÇÓÃÄ¿Ç°ÈÔÔÚ¿¼ÂÇµÄÆô·¢Ê½µÄ·½·¨¡£
ÎÒÈ·¶¨Èç¹ûÓÐÈÎºÎÈËÏëÒªÅ¬Á¦ÕÒ³ö mount ³ÌÊ½µÄ×÷Õß£¨ÃÇ£©£¬ËûÃÇ½«»á»¶Ó­ÄãµÄ½¨Òé¡£
ËùÒÔÏÖÔÚÄØ£¬Õâ±íÊ¾Äã²»ÄÜ¹ÒÔØ vfat ³ý·ÇÄã·ÅÆú×Ô¶¯Õì²âÆäËûµµ°¸ÏµÍ³µÄÄÜÁ¦¡£
Ï£ÍûÕâºÜ¿ì¾ÍÄÜ¸Ä½ø¡£ÔÚ´ËÍ¬Ê±£¬ÄãÒÑ¾­¿ÉÒÔºÜ×ÔÓÉµÄ½¨Á¢¶à¸ö¹ÒÔØµã²¢Ö¸¶¨²»Í¬µÄµµ°¸ÏµÍ³¡£






\subsection{ÎÒµÄµµ°¸ÏµÍ³ {\ttfamily /grumblesmurf} ÒÑ¾­¹ÒÉÏµ«ÊÇÓÃ {\ttfamily kill -SIGUSR1} È´ÎÞ·¨Ð¶ÔØ¡£}

Õâ±íÊ¾ËüÕýÔÚÊ¹ÓÃÖÐ¡£¿ÉÄÜÁ¬ÏµÍ³¹ÜÀíÔ±¶¼²»ÄÜÓÃÊÖ¶¯µÄÐ¶ÔØËü¡£
Èç¹ûÄãÊÇÈÃËü×Ô¶¯¹ÒÔØµÄµÄÈË(Ò²¾ÍÊÇËµ£¬²»¿ÉÄÜÊÇ±ðÈËÕýÔÚÓÃËü)¿´¿´ÊÇ²»ÊÇÓÐÒ»¸ö shell
ÊÇÔÚÄÇ¸öÄ¿Â¼ÖÐ¡£
¼ÙÈçÃ»ÓÐµÄ»°£¬ÕÒÕÒ¿´ÆäËû¶«Î÷(ÌØ±ðÏñÊÇÄ¿Â¼ä¯ÀÀÆ÷Ö®ÀàµÄ)¿ÉÄÜÁôÏÂÊ²÷á¿´²»¼ûµÄ¶«Î÷ÔÚÀïÃæ¡£
¼ÙÈçÄã·ÅÆúÑ°ÕÒ£¬Äã¿ÉÒÔÊÔÊÔ fuser ³ÌÊ½¡£




\subsection{ÓÐ autofs ÕâÑùµÄºÃ¶«Î÷£¬ÎÒÓ¦¸Ã¸ÐÐ»Ë­ÄØ£¿}

¾ö²»»áÊÇÎÒ¡£Õâ¸úÎÒÒ»µã¹ØÏµÒ²Ã»ÓÐ¡£ÎÒÖ»ÊÇÒªÈÃ´ó¼Ò×¢Òâµ½ autofs ÓÐ¶à°ô£¬ÓÐ¶à÷áµÄÈÝÒ×Ê¹ÓÃ.
±ÈÆð AMD µÄÔ­´´µÄÄÇÐ©ÈË(ÌáÊ¾£¬ËûÃÇÂôÒ»¸ö³¬¶îµÄµ¥¹¦ÄÜ²úÆ·ºÍÌ«¹ÅÊ±´ú°æµÄÃâ·Ñ¹¤¾ß) 
autofs ÓÐºÜÇå³þµÄÎÄ¼þ²¢ÇÒÎÒÓÉÖÔµÄ¸ÐÐ»Êµ×÷µÄÕâÐ©ÈË¡£
Ã¿Ñù¶«Î÷¶¼ÓÐ°æÈ¨ÉùÃ÷£¬ºÜ±§Ç¸ÎÒ²»ÄÜÌá¹©Ò»¸ö¸ÐÐ»Çåµ¥¡£






\subsection{ÎÒ¿ÉÒÔµ½ÄÄÀïÑ§¸ü¶à¹Øì¶µµ°¸ÏµÍ³×Ô¶¯¹ÒÔØµÄ×ÊÑ¶£¿}

ÓÐÒ»¸ö autofs µÄÈëÃÅÊÖ²áÔÚ url url=" http://www.linuxhq.com/lg/issue24/nielsen.html"{$>$}¡£
Ò²¿ÉÒÔ²Î¿¼ am-utils ÔÚ \nameurl{http://www.cs.columbia.edu/~ezk/am-utils}{}

(¸ÐÐ»ÕâÐ© URL)

\end{document}
