% Linux Installation and Getting Started    -*- TeX -*-
% backups.tex
% Copyright (c) 1993 by Matt Welsh and Lars Wirzenius
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by
% the copyright for the entire document, in the file "copyright.tex".

\section{Using Floppies and Making Backups}
\index{files!backing up|(}
\index{backups|(}
Floppies are usually used as backup media. If you don't have a 
tape drive connected to your system, floppy disks can be used (although
they are slower and somewhat less reliable).

You may also use floppies to hold individual filesystems---in this way,
you can {\bf mount} the floppy to access the data on it. 

\subsection{Using floppies for backups}
\index{floppy disks!as backup medium}
\index{backups!to floppy disk}
\index{backups!multi-volume}
The easiest way to make a backup using floppies is with {\tt tar}. 
The command
\begin{tscreen}
\# {\em tar cvfzM /dev/fd0 /}
\end{tscreen}
will make a complete backup of your system using the floppy drive
{\tt /dev/fd0}. The ``{\tt M}'' option to {\tt tar} allows the
backup to be a multivolume backup; that is, when one floppy is full,
{\tt tar} will prompt for the next. The command
\begin{tscreen}
\# {\em tar xvfzM /dev/fd0}
\end{tscreen}
can be used to restore the complete backup.
This method can also be used if you have a tape drive ({\tt /dev/rmt0})
connected to your system.

\index{backflops@{\tt backflops}}
\index{afio@{\tt afio}}
Several other programs exist for making multiple-volume backups; the
{\tt backflops} program found on {\tt tsx-11.mit.edu} may come in handy.

Making a complete backup of the system can be time- and resource-consuming.
Most system administrators use a incremental backup policy, in which every
month a complete backup is taken, and every week only those files which
have been modified in the last week are backed up. In this case, if
you trash your system in the middle of the month, you can simply restore
the last full monthly backup, and then restore the last weekly backups
as needed.  

\index{backups!incremental}
\index{find@{\tt find}!for incremental backups}
The {\tt find} command can be useful in locating files which have 
changed since a certain date. Several scripts for managing 
incremental backups can be found on {\tt sunsite.unc.edu}. 
\index{backups|)}
\index{files!backing up|)}

\subsection{Using floppies as filesystems}\label{sec-floppy}
\index{filesystems!on floppy disk}
\index{floppy disks!file systems on}
\index{mke2fs@{\tt mke2fs}!for floppy disk}
You can create a filesystem on a floppy just as you would on a hard
drive partition. For example,
\begin{tscreen}
\# {\em mke2fs /dev/fd0 1440}
\end{tscreen}
creates a filesystem on the floppy in {\tt /dev/fd0}. The size of the
filesystem must correspond to the size of the floppy. High-density
3.5" disks are 1.44 megabytes, or 1440 blocks, in size. High-density
5.25" disks are 1200 blocks. 

\index{mount@{\tt mount}!mounting floppy disk with}
In order to access the floppy, you must {\bf mount} the filesystem
contained on it. The command
\begin{tscreen}
\# {\em mount -t ext2 /dev/fd0 /mnt}
\end{tscreen}
will mount the floppy in {\tt /dev/fd0} on the directory {\tt /mnt}. 
Now, all of the files on the floppy will appear under {\tt /mnt}
on your drive. The ``{\tt -t ext2}'' specifies an ext2fs filesystem type.
If you created another type of filesystem on the floppy, you'll
need to specify its type to the {\tt mount} command.

\index{mount point!defined}
The ``mount point'' (the directory where you're mounting the filesystem)
needs to exist when you use the {\tt mount} command. If it doesn't exist,
simply create it with {\tt mkdir}.

See Section~\ref{sec-manage-fs} for more information on filesystems, mounting,
and mount points. 

\index{floppy disk!unmounting}
\index{umount@{\tt umount}!unmounting floppy disks with}
\blackdiamond Note that any I/O to the floppy is buffered just as hard 
disk I/O is.
If you change data on the floppy, you may not see the drive light come
on until the kernel flushes its I/O buffers. It's important that you 
not remove a floppy before you unmount it; this can be done with the
command
\begin{tscreen}
\# {\em umount /dev/fd0}
\end{tscreen}
Do not simply switch floppies as you would on an MS-DOS system; whenever
you change floppies, {\tt umount} the first one and {\tt mount} the
next.


