\section{Filesystem Concepts}

\begin{frame}
   {Inodes}

   \begin{itemize}
      \item The \textbf{name} of a file is just a property of its
      \textbf{inode}, which is the more fundamental object.
      \item Inodes are stored on the filesystem as well as being
      data structures in memory.
      \item Inodes describe and store information about a
      file including:
      \begin{itemize}
         \item Permissions
         \item User, group ownership
         \item Size
         \item Timestamps (nanosecond)
         \begin{itemize}
            \item Last access time
            \item Last modification time
            \item Change time
         \end{itemize}
      \end{itemize}
      \item
      Filenames are \textbf{not} stored in the inode;
      they are stored in the \textbf{directory}
   \end{itemize}

\end{frame}

\cprotect\note{

   An inode is a data structure on disk that describes
   and stores a file's attributes, including its
   location.

   Every file which is contained in a \textbf{Linux}
   filesystem is associated with its own inode.  All data
   about a file is contained within its inode.  The inode is
   used by the operating system to keep track of properties
   such as name, location, file attributes (permissions,
   ownership, etc.), access times and other items.  Because
   of this, all I/O activity concerning a file usually also
   involves the file's inode.
}

\begin{frame}
   {Hard and Soft Links}

   \begin{itemize}
      \item \textbf{Hard} links point to an inode.
      \begin{itemize}
         \item Two or more files can point to the same inode
         (hard link)
         \item All hard linked files have to be on the same
         filesystem
      \end{itemize}
      \item \textbf{Soft} (or \textbf{symbolic}) links point to
      a file name with an associated inode.
      \begin{itemize}
         \item Soft linked files may be on different
         filesystems
         \item The target may not exist or yet be mounted,
         it can be \textbf{dangling}
      \end{itemize}
      \item Be careful with hard linked files:
      \begin{itemize}
         \item
         Changing the contents in one place may not change it
         at others
      \end{itemize}
   \end{itemize}
   \begin{figure}[H]
      \includegraphics[height=1.0in]{IMAGES/hard_and_soft_links}
      \caption{Hard and Soft Links}
   \end{figure}
\end{frame}

\cprotect\note{

   A \textbf{directory file} is a particular type of file
   that is used to associate file names and inodes.  There
   are two ways to associate (or \textbf{link}) a file name
   with an inode:

   \begin{itemize}
      \item \textbf{Hard} links point to an inode.  They are
      made by using \textbf{ln} without an option.
      \item \textbf{Soft} (or \textbf{symbolic}) links point
      to a file name which has an associated inode.  They
      are made with using \textbf{ln} with the \verb?-s?
      option.
   \end{itemize}

   Each association of a directory file contents and
   an inode is known as a link.  Additional links can be
   created using \textbf{ln}.

   Because it is possible (and quite common) for two or more
   directory entries to point to the same inode (hard links), a
   file can be known by multiple names, each of which has its
   own place in the directory structure.  However, it can have
   only one inode no matter which name is being used.

   When a process refers to a pathname, the kernel searches
   directories to find the corresponding inode number. After
   the name has been converted to an inode number, the inode is
   loaded into memory and is used by subsequent requests.
}


