\section{Partition table editors}

\begin{frame}
   {Partition Table Editors}

   \begin{itemize}
      \item \textbf{fdisk}: standard, menu oriented
      \item \textbf{sfdisk}: script or command line
      interface
      \item \textbf{parted}: GNU partition manipulation
      program
      \item \textbf{gparted}: GUI based version of
      \textbf{parted}
      \item \textbf{gdisk}: For \textbf{GPT} systems; can
      also operate on \textbf{MBR} systems
      \item \textbf{sgdisk}: script or command line
      interface
   \end{itemize}

\end{frame}

\cprotect\note{

   \textbf{fdisk} is a menu driven partition table
   editor.  It is the most standard and one of the most
   flexible of the partition table editors.  As with any
   partition table editor, make sure that you either
   write down the current partition table settings or
   make a copy of the current settings before making
   changes.

   The \textbf{sfdisk} command is a non-interactive
   \textbf{Linux}-based partition editor program, making it useful
   for scripting.  Use the \textbf{sfdisk} tool with
   care.

   For \textbf{GPT} systems, \textbf{gdisk} and \textbf{sgdisk}
   play a similar role.  Both also work on \textbf{MBR} systems.

   \textbf{parted} is the GNU partition manipulation
   program.  It can create, remove, resize, and move
   partitions (including certain filesystems). The GUI
   interface to the \textbf{parted} command is
   \textbf{gparted}.

   Many \textbf{Linux} distributions have a
   \textbf{live/installation} version which can be run
   off either a \textbf{CDROM} or \textbf{USB} stick,
   which include a copy of \textbf{gparted}, so they can
   easily be used as a graphical partitioning tool on
   disks which are not actually being used while the
   partitioning program is run.

}

\section{fdisk}
\begin{frame}
   {Using fdisk}

   \begin{itemize}
      \item Part of the base install, easy to use
      \item Menu oriented, just follow prompts:
      \begin{itemize}
         \item \texttt{m}: Display the menu.
         \item \texttt{p}: List the partition table.
         \item \texttt{n}: Create a new partition.
         \item \texttt{d}: Delete a partition.
         \item \texttt{t}: Change a partition type.
         \item \texttt{w}: Write the new partition table
         information and exit.
         \item \texttt{q}: Quit without making changes.
      \end{itemize}
      \item Edit the partition table:
      \begin{cmd}
$ sudo fdisk /dev/sda
      \end{cmd}
      \item Display the partition table and take no action:
      \begin{cmd}
$ sudo fdisk -l /dev/sda
      \end{cmd}
   \end{itemize}

\end{frame}

\cprotect\note{

   You must be root to run \textbf{fdisk}.  It can be
   somewhat complex to handle and caution is advised.  The
   \textbf{fdisk} interface is text-menu driven.  After
   starting on a particular disk as in:
   \begin{cmd}
$ sudo fdisk /dev/sdb
   \end{cmd}
   you can issue the one-letter commands itemized above.

   Fortunately, no actual changes are made until you write
   the partition table to the disk by entering \texttt{w}.
   It is therefore important to verify your partition
   table is correct (with \texttt{p}), before writing to
   disk with \texttt{w}. If something is wrong, you can
   jump out safely with \texttt{q}.

   The system will not use the new partition table until
   you reboot.  However, you can use the following
   command:
   \begin{cmd}
$ sudo partprobe -s
   \end{cmd}
   to try and read in the revised partition table.
   However, this does not always work reliably and it is
   best to reboot before doing things like formatting new
   partitions etc as mixing up partitions can be
   catastrophic.

   At any time you can do:
   \begin{cmd}
$ cat /proc/partitions
   \end{cmd}
   to examine what partitions the operating system is
   currently aware of.
}

