[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing my backups



On 10/07/17 00:45, Niels Kobschaetzki wrote:
> is there an automatic way to test my backups? 

Depends what you mean by "automatic" and how much you want to test. :-)

The simplest test is simply to check the exit code of the tarsnap process: If
it exits with 0 ("success") then it thinks it successfully created an archive.
(It is possible for tarsnap to exit with a non-zero status even if an archive
was created; for example, if the network connection drops after tarsnap sends
the "ok, this archive is done" message but before the server responds.)

Or you could run
# tarsnap --list-archives
and check that the output includes the names of the archives you were trying
to create.

Or you could run
# tarsnap -t -f archivename
and check that the listing of files matches what you thought you archived.

Or you could run something like
# TMPOUT=`mktemp -t tarsnap` || exit 1
# tarsnap -x -f archivename -X $TMPOUT
# diff -rNq $TMPOUT /path/to/stuff/you/archived
# rm -r $TMPOUT
to extract everything and compare against the files you (still) have on
disk... subject of course to the caveat that some files will probably
change between when you create an archive and when you test it.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid