\begin{exe} {Managing Swap Space}

   Examine your current swap space by doing:
   \begin{cmd}
$ cat /proc/swaps
   \end{cmd}
   \begin{response}
Filename                                Type            Size    Used    Priority
/dev/sda11                              partition       4193776 0       -1
   \end{response}
   We will now add more swap space by adding either a new
   partition or a file.  To use a file we can do:
   \begin{cmd}
$ dd if=/dev/zero of=swpfile bs=1M count=1024
   \end{cmd}
   \begin{response}
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 1.30576 s, 822 MB/s
   \end{response}
   \begin{cmd}
$ mkswap swpfile
   \end{cmd}
   \begin{response}
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=85bb62e5-84b0-4fdd-848b-4f8a289f0c4c
   \end{response}
   (For a real partition just feed \textbf{mkswap} the
   partition name, but be aware all data on it will be
   erased!)

   Activate the new swap space:
   \begin{cmd}
$ sudo swapon swpfile
   \end{cmd}
   \begin{response}
swapon: /tmp/swpfile: insecure permissions 0664, 0600 suggested.
swapon: /tmp/swpfile: insecure file owner 500, 0 (root) suggested.
   \end{response}
   \begin{redhatfamilybox}
      Notice \textbf{RHEL} warns us we are being insecure, we really
      should fix with:
      \begin{cmd}
$ sudo chown root:root swpfile
$ sudo chmod 600 swpfile
      \end{cmd}
   \end{redhatfamilybox}
   We ensure \verb?swpfile? is being used:
   \begin{cmd}
$ cat /proc/swaps
      \end{cmd}
   \begin{response}
Filename                                Type            Size    Used    Priority
/dev/sda11                              partition       4193776 0       -1
/tmp/swpfile                            file            1048572 0       -2
      \end{response}
   Note the \verb?Priority? field; swap partitions or files
   of lower priority will not be used until higher priority
   ones are filled.


   Remove the swap file from use and delete it to save
   space:
   \begin{cmd}
$ sudo swapoff swpfile
$ sudo rm swpfile
   \end{cmd}
\end{exe}

