\section{automount}
\begin{frame}
   {Automatic Filesystem Mounting}

   \begin{itemize}

      \item
      Make filesystem available on use (\textbf{mount}),
      remove on idle (\textbf{umount})
      \item
      \textbf{autofs}:
      \begin{itemize}
         \item
         Available for many years,
         \item
         Requires installation of \textbf{autofs} package
         \item
         Flexible, configuration files in \filelink{/etc}
      \end{itemize}
      \item
      \textbf{automount}
      \begin{itemize}

         \item
         Part of \textbf{systemd}
         \item
         Modify \filelink{/etc/fstab}, and reboot or restart
         \textbf{systemd} as in:
         \begin{cmd}
$ sudo systemctl daemon-reload
$ sudo systemctl restart local-fs.target
         \end{cmd}
      \end{itemize}
   \end{itemize}

\end{frame}

\cprotect\note{

   \textbf{Linux} systems have long had the ability to mount
   a filesystem only when it is needed.  Historically, this
   was done using \textbf{autofs}.

   This utility requires installation of the \textbf{autofs}
   package using the appropriate package manager and
   configuration of files in \filelink{/etc}

   While \textbf{autofs} is very flexible and well
   understood, \textbf{systemd}-based systems (including all
   enterprise \textbf{Linux} distributions) come with
   \textbf{automount} facilities built into the
   \textbf{systemd} framework.  Configuring this is as simple
   as adding a line in \textbf{/etc/fstab} specifying the
   proper device, mount point and mounting options, such as:

   \begin{kcode}
LABEL=Sam128 /SAM ext4 noauto,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=30 0 0
   \end{kcode}

   and then either rebooting or issuing the command:
   \begin{cmd}
$ sudo systemctl daemon-reload
$ sudo systemctl restart local-fs.target
   \end{cmd}

   On the next page we will give an example and explain the
   options.

}
\begin{frame}
   {automount Example}

   \begin{figure}[H]
      \includegraphics[width=6.6in]{IMAGES/automount}
      \caption{automount Example}
   \end{figure}

\end{frame}

\cprotect\note{

   The above example mounts a \textbf{USB} pen drive that is
   always plugged into the system, only when it is used.

   Options in \filelink{/etc/fstab}:
   \begin{itemize}
      \item
      \verb?noauto?

      Do not mount at boot.  Here \texttt{auto} does not refer
      to \textbf{automount}.

      \item
      \verb?x-systemd.automount?

      Use the \textbf{systemd} \textbf{automount} facility

      \item
      \verb?x-systemd.automount.device-timeout=10?

      If this device is not available, say it is a network
      device accessible through \textbf{NFS}, timeout after 10
      seconds instead of getting hung.

      \item
      \verb?x-systemd.automount.idle-timeout=30?

      If the device is not used for 30 seconds, unmount it.
   \end{itemize}

   Note that the device \textbf{may} be mounted during boot,
   but then it should be unmounted after the timeout specified.

   The screenshot shows how the device is only available once
   it is used.

}
