\section{Naming Disk Devices}

\begin{frame}
   {Naming Disk Devices and Device Nodes}

   \begin{itemize}
      \item Device files found in \filelink{/dev} directory
      \item Name format: \texttt{xxy}[\texttt{z}]
      \begin{itemize}
         \item \texttt{xx} is the device type (usually
         \texttt{sd})
         \item \texttt{y} is a letter for the drive
         number (\texttt{a,b,c}, etc)
         \item \texttt{z} is the partition number
      \end{itemize}
      \item Sample:
      \begin{itemize}
         \item \filelink{/dev/sda} is the first drive
         found
         \item \filelink{/dev/sdb2} is the second
         partition on the second drive
      \end{itemize}
   \end{itemize}

\end{frame}

\cprotect\note{

   The \textbf{Linux} kernel interacts at a low level with
   disks through \textbf{device nodes} normally found in
   the \filelink{/dev} directory.  Normally device nodes
   are accessed only through the infrastructure of the
   kernel's \textbf{Virtual File System}; raw access
   through the device nodes is an extremely efficient way
   to destroy a filesystem.

   For an example of proper raw access, you can format a
   partition, as in:
   \begin{cmd}
$ sudo mkfs.ext4 /dev/sda9
   \end{cmd}

   Device nodes for \textbf{SCSI} and \textbf{SATA} disks
   follow a simple naming convention:
   \begin{itemize}
      \item The first hard disk is \filelink{/dev/sda}.
      \item The second hard disk is \filelink{/dev/sdb}.
      \item etc.
   \end{itemize} Partitions are also easily enumerated as in:
   \begin{itemize}
      \item \filelink{/dev/sdb1} is the first partition on the
      second disk.
      \item \filelink{/dev/sdc4} is the fourth partition on the
      third disk.
   \end{itemize}

   In the above \texttt{sd} means \textbf{SCSI} or
   \textbf{SATA} disk.  Back in the days where
   \textbf{IDE} disks could be found they would have been
   \filelink{/dev/hda3}, \filelink{/dev/hdb} etc.

   Doing \texttt{ls -l /dev} will show you the current
   available disk device nodes.

}

\section{blkid and lsblk}
\begin{frame}
   {blkid}

   \begin{itemize}
      \item Command line utility to locate and print block
      device attributes
      \item Report on content of block device
      \item Report on attributes of block device
      \item Sample commands:
      \begin{cmd}
$ sudo blkid
$ sudo blkid /dev/sda*
$ sudo blkid -L root
      \end{cmd}

   \end{itemize}

\end{frame}

\cprotect\note{

   \textbf{blkid} is a utility to locate block devices and
   report on their attributes.  It works with the
   \textbf{libblkid} library.  It can take as an argument
   a particular device or list of devices.

   It can determine the type of content
   (e.g. filesystem, swap) a block device holds, and also
   attributes (tokens, NAME=value pairs) from the content
   meta-data (e.g. LABEL or UUID fields).

   \textbf{blkid} will only work on devices which contain
   data that is finger-printable; e.g., an empty
   partition will not generate a block-identifying
   \textbf{UUID}.

   \textbf{blkid} has two main forms of operation: either
   searching for a device with a specific
   \texttt{NAME=value}  pair, or displaying
   \texttt{NAME=value} pairs for one or more devices.

   Without arguments it will report on all devices.
   There are quite a few options designating how to
   specify devices and what attributes to report on.

   \begin{figure}[H]
      \includegraphics[width=7.0in]{IMAGES/blkid}
      \caption{Using blkid}
   \end{figure}

}

\begin{frame}
   {lsblk}

   \begin{itemize}
      \item Presents block device information in  tree format
   \end{itemize}

   \begin{figure}[H]
      \includegraphics[height=3.0in]{IMAGES/lsblk}
      \caption{Using lsblk}
   \end{figure}

\end{frame}

\cprotect\note{

   \begin{cmd}
$ lsblk -h
  \end{cmd}
   \begin{responsevar}{\scriptsize}
Usage:
 lsblk [options] [<device> ...]

List information about block devices.

Options:
 -a, --all            print all devices
 -b, --bytes          print SIZE in bytes rather than in human readable format
 -d, --nodeps         don't print slaves or holders
 -D, --discard        print discard capabilities
 -z, --zoned          print zone model
 -e, --exclude <list> exclude devices by major number (default: RAM disks)
 -f, --fs             output info about filesystems
 -i, --ascii          use ascii characters only
 -I, --include <list> show only devices with specified major numbers
 -J, --json           use JSON output format
 -l, --list           use list format output
 -T, --tree           use tree format output
 -m, --perms          output info about permissions
 -n, --noheadings     don't print headings
 -o, --output <list>  output columns
 -O, --output-all     output all columns
 -p, --paths          print complete device path
 -P, --pairs          use key="value" output format
 -r, --raw            use raw output format
 -s, --inverse        inverse dependencies
 -S, --scsi           output info about SCSI devices
 -t, --topology       output info about topology
 -x, --sort <column>  sort output by <column>

 -h, --help           display this help
 -V, --version        display version

 Available output columns:
 ......
 For more details see lsblk(8).
\end{responsevar}
}

