Subject: Re: verifying a backup
To: Simon Burge <simonb@telstra.com.au>
From: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
List: netbsd-help
Date: 06/30/1998 00:31:50
On Tue, Jun 30, 1998 at 01:57:32PM +1000, Simon Burge wrote:
> On Mon, 29 Jun 1998 20:28:08 +0200 (MET DST)  Christoph Badura wrote:
> 
> > mcr@sandelman.ottawa.on.ca (Michael C. Richardson) writes:
> > 
> > >  How can I verify a backup done with dump?
> > >  "restore -tv" just reads the list of files, not all the blocks.
> > 
> > >  I could do:
> > >	(restore -tv ; dd of=/dev/null)
> 
> The procedure we use around here is to get the last file name of the
> tape (with "restove -tv"), back up to the start of the archive, and
> then actually restore that file in a temporary directory somewhere.

  Recently, one of our tape drives started failing/corrupting
silently, but we didn't notice right away.  When we tried to
restore some files off of a bad dump tape a few weeks after the
drive started misbehaving, the files were mostly correct, but
not completely.  So a more-accurate-but-expensive verify
operation might be handy.  Maybe something along the lines of,
for each file on the tape:

  if mod time of file on disk is older than backup time:
    do cksum of the file on tape
    do cksum of the file on disk
    re-verify that the mod time on disk is still older (avoid races)
    compare the cksums

  This would obviously be quite expensive.  The cksum of the file
on tape can probably be done internally faster than restore'ing
it to a temporary directory and then cksum'ing it (many fewer
syscalls, that's for sure!).  Such an internal cksum'ing off
the tape would also be handy when verifying a large file on
tape that is too large to fit into /tmp, say.

  Even though the above would be expensive if performed for every
dump, I'd personally perform such a full verification
occasionally (once a week at 2am?) just to catch any hardware
failures sooner and increase my confidence in our backup system.

  Brian
-- 
"This is basically one-variable calculus, except you ... (laugh) ... have
two variables!" -- Ken Richardson, guest lecturer for Math 381