%% $Header: /cvsroot/lcdp/lpic/general-linux-1/slides/gl1.104.2.slides.tex,v 1.3 2003/05/30 05:04:30 waratah Exp $


\input{gl1.slide-header.tex}
\usepackage{epsfig}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80->
\begin{slide} %================================================================
\begin{center} \LARGE \textsf{-- General Linux 1 -- \\
Maintain the integrity of filesystems} \\[2mm]
\large  \textsf{(Linux Professional Institute Certification)}\\[1mm]

\normalsize\end{center}

\footnote{Copyright \copyright\ 2002 Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation---either version 2 of the License or (at your option) any later version.}
 
\scriptsize
\begin{verbatim} 
   .~.    
   /V\     by: geoffrey robertson        
  // \\        geoffrey@zip.com.au
  @._.@ 
\end{verbatim} 
\tiny
\begin{verbatim}
$Id: gl1.104.2.slides.tex,v 1.3 2003/05/30 05:04:30 waratah Exp $ 
\end{verbatim} 
\normalsize  
\vfill \end{slide} %-----------------------------------------------------------
%----10->|-----20->|-----30->|-----40->|-----50->|-----60->|-----70->|-----80->


%==============================================================================
%==============================================================================
\begin{slide} %ghr
  \slideheading{Devices, Linux Filesystems \& FHS}
  \begin{description}
  \item[1.104.1] Create partitions and filesystems
  \item[1.104.2] {\bf \underline{Maintain the integrity of filesystems}}
  \item[1.104.3] Control mounting and unmounting filesystems
  \item[1.104.4] Managing disk quota
  \item[1.104.5] Use file permissions to control access to files
  \item[1.104.6] Manage file ownership
  \item[1.104.7] Create and change hard and symbolic links
  \item[1.104.8] Find system files and place files in the correct location
\end{description}
\vfill \end{slide} %-----------------------------------------------------------
  
%==============================================================================
\begin{slide}
  \slideheading{Maintain the integrity of filesystems}
\slidesubheading{Objective}

Candidates should be able to verify the integrity of filesystems,
monitor free space and inodes, and repair simple filesystem problems.
This objective includes the commands required to maintain a standard
filesystem, as well as the extra data associated with a \textit{journaling}
filesystem.

\slidesubheading{Key files, terms, and utilities include:}
\begin{alltt}
du   df   fsck  e2fsck   mke2fs  
debugfs   dumpe2fs   tune2fs
\end{alltt}

\normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================
\begin{slide}
  \slideheading{Summary of Commands}
  \begin{tabular}{|c|l|} \hline
    \textit{Command} & \textit{Function}\\ \hline
    du & Display disk usage\\ \hline
    df & Display disk space free\\ \hline
    fsck & Check Filesystem\\ \hline
    e2fsck & Check an ext2 Filesystem\\ \hline
    mke2fs & Create an ext2 Filesystem\\ \hline
    debugfs & Debug an ext2 Filesystem\\ \hline
    dumpe2fs & Dump Filesystem information\\ \hline
    tune2fs & Adjust parameters on ext2 Filesystem\\ \hline

  \end{tabular}
 \normalsize \vfill \end{slide} %---------------------------------------
 
%==============================================================================
\begin{slide}
  \slideheading{\texttt{du} - Disk Usage}
  \begin{itemize}
  \item du shows \textit{disk usage}
  \item du can work with subdirectories or an entire disk
  \item Usage is:

    \texttt{du [options] [directory]}
  \end{itemize}
 \normalsize \vfill \end{slide} %---------------------------------------

%============================================================================== 
\begin{slide}
  \slideheading{Options to du}

  \begin{tabular}{|c|l|} \hline
    \textit{Option} & \textit{Function}\\ \hline
    -a & Show counts for all files \& directories\\ \hline
    -b & Display size in bytes\\ \hline
    -c & Print total for all arguments after processing\\ \hline
    -h & Print in \textit{human readable} form\\ \hline
    -k & Show size in Kilobytes\\ \hline
    -m & Display size in Megabytes\\ \hline
    -s & Display a summary for each argument\\ \hline
    -x & Skip directories containing other filesystems\\ \hline
  \end{tabular}

\normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================
\begin{slide}
\slideheading{\texttt{df} - Disk Free}
  \begin{itemize}
  \item df shows disk space used \& available
  \item Default is to display all filesystems
  \item Usage is:

    \texttt{df [options] [directory]}
  \end{itemize}
\normalsize \vfill \end{slide} %---------------------------------------

%============================================================================== 
\begin{slide}
  \slideheading{Options to df}

  \begin{tabular}{|l|l|} \hline
    \textit{Option} & \textit{Function}\\ \hline
    -a & Show counts for all filesystems\\ \hline
    -t \textit{fs type} & Limit listing to \textit{fs type}\\ \hline
    -h & Print in \textit{human readable} form\\ \hline
    -k & Show size in Kilobytes\\ \hline
    -m & Display size in Megabytes\\ \hline
    -i & Display inode information\\ \hline
    -l & Limit listing to local filesystems\\ \hline
    -x \textit{fs type} & Exclude \textit{fs type} from listing\\ \hline
  \end{tabular}

\normalsize \vfill \end{slide} %---------------------------------------


%==============================================================================
\begin{slide}
  \slideheading{\texttt{fsck} - Check and repair a Linux file system}
  \begin{itemize}
  \item fsck is used to check and optionally repair a one or more Linux
    file systems.
  \item filesys can be a device name (e.g.  /dev/hdc1, /dev/sdb2), a
    mount point (e.g.  /, /usr, /home), or an ext2 label.
    
  \item fsck will try to run filesystems on different physical drives in parallel to reduce total amount time to
    check all of the filesystems.
  \item fsck makes 5 passes on the filesystem:
    \begin{itemize}
    \item Pass 1: Check inodes, blocks \& sizes
    \item Pass 2: Check directory structure
    \item Pass 3: Check directory connectivity
    \item Pass 4: Check reference counts
    \item Pass 5: Check group summary information
    \end{itemize}
  \end{itemize}
  \normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================

\begin{slide}
  \slideheading{fsck Options}
 \begin{tabular}{|l|l|} \hline
    \textit{Option} & \textit{Function}\\ \hline
    -p & Automatically repair without prompting\\ \hline
    -n & Don't make changes to filesystem\\ \hline
    -y & Assume yes to all questions\\ \hline
    -f & Force check even if fs is clean\\ \hline
    -r & Interactively prompt for changes\\ \hline
    -v & Be verbose\\ \hline
    -A & Check all filesystems in \texttt{/etc/fstab}\\ \hline
    -C & Display a progress bar\\ \hline
    -N & Don't execute, show what would be done\\ \hline
  \end{tabular}

  \normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================
\begin{slide}
  \slideheading{fsck error codes}
When fsck completes, it will return a value (\texttt{\$?}) as follows:

 \begin{tabular}{|l|l|} \hline
    \textit{Code} & \textit{Meaning}\\ \hline
    0 & No errors\\ \hline
    1 & Errors found \& corrected\\ \hline
    2 & System should be rebooted\\ \hline
    4 & Filesystem error left uncorrected\\ \hline
    8 & Operational error\\ \hline
    16 & Usage or syntax error\\ \hline
    128 & Shared library error\\ \hline
  \end{tabular}

  \normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================

\begin{slide}
  \slideheading{\texttt{e2fsck} - Check a Linux ext2 FS} 
  \begin{itemize}
  \item e2fsck is used to check a Linux second extended file  system (e2fs)
  \item e2fsck also supports ext2 filesystems containing a journal, which are also sometimes known as ext3
    filesystems.
  \item e2fsck operates in a similar manner to fsck (see man page)
  \end{itemize}
  \normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================

\begin{slide}
  \slideheading{\texttt{mke2fs} - Create a Linux ext2 filesystem} 
  \begin{itemize}
  \item mke2fs is used to create an ext2 filesystem
  \item mke2fs takes a device special file as its argument
  \item mkfs.ext2 is the same as mke2fs
  \item To make an ext3 filesystem, you first make an ext2 filesystem and 
    then add a journal to it using tune2fs or use the \texttt{-j} option to mke2fs 
  \item Usage is:

    \texttt{mke2fs [options] device}

\end{itemize}
\normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================

\begin{slide}
  \slideheading{mke2fs Options}
 \begin{tabular}{|l|l|} \hline
    \textit{Option} & \textit{Use}\\ \hline
    -V & Be verbose\\ \hline
    -b \textit{blocksize} & Make blocks \textit{blocksize} bytes\\ \hline
    -c & Check for bad blocks on device\\ \hline
    -i \textit{bytes per inode} & Create an inode for each \textit{bytes per inode}\\ \hline
    -j & Create a journal (ext3)\\ \hline
    -L \textit{label} & Set the volume label\\ \hline
    -N \textit{inodes} & Create the fs with specified number of inodes\\ \hline
    -n & Show what would be done (don't actually create fs)\\ \hline
  \end{tabular}

  \normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================

\begin{slide}
\slideheading{\texttt{debugfs} - Ext2 filesystem debugger}

\begin{itemize}
  \item debugfs is a file system debugger
  \item It can be used to examine and change the state of an ext2 file system.
  \item debugfs is an interactive debugger. It understands a number of
    commands:
    \begin{description}
    \item[cat filespec] Dump the contents of the inode filespec to  stdout.
    \item[cd filespec] Change the current working directory to filespec.
    \item[chroot filespec]  Change the root directory to be the directory file spec.
    \item[close] Close the currently open file system.
    \item[quit] Exit debugfs.
    \end{description}
  \end{itemize}
  \normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================
\begin{slide}
  \slideheading{\texttt{dumpe2fs} - Dump filesystem information}
  \begin{itemize}
  \item dumpe2fs prints the super block and blocks group information for the filesystem present on device
  \item Usage is:

    \texttt{dumpe2fs [options] device}
  \item Common options are:

 \begin{tabular}{|l|l|} \hline
    \textit{Option} & \textit{Use}\\ \hline
    -b & Display badblocks on device\\ \hline
    -h & Display superblock information\\ \hline
  \end{tabular}
\end{itemize}
\normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================
\begin{slide}
  \slideheading{\texttt{tune2fs} - Adjust filesystem parameters on ext2 fs}
  \begin{itemize}
  \item tune2fs adjusts tunable filesystem parameters on a Linux ext2 filesystem.
  \item tune2fs can be used to add a journal to an ext2 filesystem.
\item Usage is:

\texttt{tune2fs [options] device}
\end{itemize}
\normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================
\begin{slide}
  \slideheading{tune2fs - Common options}

 \begin{tabular}{|l|l|} \hline
    \textit{Option} & \textit{Use}\\ \hline
    -c \textit{max-mounts} & Set no of mounts before fsck is forced\\ \hline
    -g \textit{group} & Set the group who can use reserved blocks\\ \hline
    -j & Add a journal to the filesystem\\ \hline
    -L \textit{label} & Set the volume label\\ \hline
    -r \textit{blocks} & Set the number of reserved blocks\\ \hline
  \end{tabular}
\normalsize \vfill \end{slide} %---------------------------------------

%==============================================================================




\end{document}

