\begin{exe} {Modifying Filesystem Parameters with tune2fs}

   We are going to fiddle with some properties of a
   formatted \textbf{ext4} filesystem.  This does not
   require unmounting the filesystem first.

   In the below you can work with an image file you create
   as in:
   \begin{cmd}
$ dd if=/dev/zero of=imagefile bs=1M count=1024
$ mkfs.ext4 imagefile
   \end{cmd}
   or you can substitute \filelink{/dev/sdaX} (using
   whatever partition the filesystem you want to modify is
   mounted on) for \verb?imagefile?.

   \begin{enumerate}
      \item
      Using \textbf{dumpe2fs}, obtain information about the
      filesystem whose properties you want to adjust.

      Display:
      \begin{itemize}
         \item
         The maximum mount count setting (after which a
         filesystem check will be forced.)
         \item
         The \verb?Check interval? (the amount of time
         after which a filesystem check is forced)
         \item
         The number of blocks reserved, and the total number of
         blocks
      \end{itemize}
      \item Change:
      \begin{itemize}
         \item
         The maximum mount count to \verb?30?.
         \item
         The \verb?Check interval? to three weeks.
         \item
         The percentage of blocks reserved to 10 percent.
      \end{itemize}
      \item
      Using \textbf{dumpe2fs}, once again obtain information about the
      filesystem and compare with the original output.
   \end{enumerate}

   \begin{sol}

      \begin{enumerate}
         \item
         \begin{cmd}
$ dumpe2fs imagefile > dumpe2fs-output-initial
         \end{cmd}
         \begin{response}
dumpe2fs 1.42.9 (28-Dec-2013)
         \end{response}
         \begin{cmd}
$ grep -i  -e "Mount count" -e "Check interval" -e "Block Count" dumpe2fs-output-initial
         \end{cmd}
         \begin{response}
Block count:              262144
Reserved block count:     13107
Mount count:              0
Maximum mount count:      -1
Check interval:           0 (<none>)
         \end{response}
         \item
         \begin{cmd}
$ tune2fs -c 30 imagefile
         \end{cmd}
         \begin{response}
tune2fs 1.42.9 (28-Dec-2013)
Setting maximal mount count to 30
         \end{response}
         \begin{cmd}
$ tune2fs -i 3w imagefile
         \end{cmd}
         \begin{response}
tune2fs 1.42.9 (28-Dec-2013)
Setting interval between checks to 1814400 seconds
         \end{response}
         \begin{cmd}
$ tune2fs -m 10 imagefile
         \end{cmd}
         \begin{response}
tune2fs 1.42.9 (28-Dec-2013)
Setting reserved blocks percentage to 10% (26214 blocks)
         \end{response}
         \item
         \begin{cmd}
$ dumpe2fs imagefile > dumpe2fs-output-final
         \end{cmd}
         \begin{response}
dumpe2fs 1.42.9 (28-Dec-2013)
         \end{response}
         \begin{cmd}
$ grep -i  -e "Mount count" -e "Check interval" -e "Block Count" dumpe2fs-output-final
         \end{cmd}

         \begin{response}
Block count:              262144
Reserved block count:     26214
Mount count:              0
Maximum mount count:      30
Check interval:           1814400 (3 weeks)
         \end{response}
         \begin{cmd}
$ diff dumpe2fs-output-initial dumpe2fs-output-final
         \end{cmd}
         \begin{response}
14c14
< Reserved block count:     13107
---
> Reserved block count:     26214
29c29
< Last write time:          Wed Oct 26 14:26:19 2016
---
> Last write time:          Wed Oct 26 14:26:20 2016
31c31
< Maximum mount count:      -1
---
> Maximum mount count:      30
33c33,34
< Check interval:           0 (<none>)
---
> Check interval:           1814400 (3 weeks)
> Next check after:         Wed Nov 16 13:26:16 2016
         \end{response}
      \end{enumerate}
   \end{sol}
\end{exe}

