\section{Checking and Repairing Filesystems}

\begin{frame}
   {fsck}
   \begin{itemize}
      \item Run automatically after a set period of time or
      number of mounts
      \item Run at boot when not unmounted cleanly previously
      \item Should not be run on mounted filesystems
      \item General format for \textbf{fsck}:
      \begin{cmd}
fsck [-t fstype] [options] [device-file]
      \end{cmd}
      where \texttt[device-file] is usually a device name like
      \filelink{/dev/sda3} or \filelink{/dev/vg/lvm1}.
      \item Filesystem type usually not needed as partition
      superblock is examined

      \item Equivalent commands:
      \begin{cmd}
$ sudo fsck -t ext4 /dev/sda10
$ sudo fsck.ext4 /dev/sda10
      \end{cmd}

   \end{itemize}

\end{frame}

\cprotect\note{

   Every filesystem type has a utility designed to check
   for errors (and hopefully fix any that are found).  The
   generic name for these utilities is \textbf{fsck}.
   However this is just a front-end for filesystem-specific
   programs:

   \begin{figure}[H]
      \includegraphics[width=4.5in]{IMAGES/fsck}
      \caption{fsck}
   \end{figure}
   \vspace {-20pt}
   You can force a check of all mounted filesystems at boot
   by doing:
   \begin{cmd}
$ sudo touch /forcefsck
$ sudo reboot
   \end{cmd}
   \filelink{/forcefsck} will disappear after the successful
   check.

   One can control whether any errors found should be fixed one
   by one manually with the \texttt{-r} option, or automatically
   as best possible by using the \texttt{-a} option.  In
   addition, each filesystem type may have its own particular
   \textbf{fsck} options.

}


