Following is an update to my question of Jun 1, where I ask the following
question:
On Wed, Jun 1, 2016 at 9:58 AM, Michael Schwager <mschwage_at_gmail.com> wrote:
> ...
> My question is: How do I back (subversion repos) up reliably, and verify
> (them) so that I can deliver a 100% recovery guarantee to my boss?
> ...
> I have compiled subversion-1.9.4 on the server under
> /opt/subversion-1.9.4. If I run that version of svn hotcopy, it appears to
> work and svnverify exits successfully. But ... I find that a file is
> missing: repos2/db/rev-prop-atomics.shm .
>
I have implemented a script that performs the following, in abbreviated
Bash form. Note that I have enough disk space for the original repos
directories, plus 2 copies. I am backup up the whole enchilada to tape. And
archiving it to another pair of tapes monthly and taking one of them
offsite. There... that oughta do it :-) . Without further ado:
LOGFILE=/var/log/backup_svn.$(date +%a)
exec 1>&$LOGFILE
exec 2>&1
REPODIR=/home/svn/svn/repositories
HOTCOPYDIR=/home/svn/hotcopy
RSYNCDIR=/home/svn/rsync
RELIABLE_SVNADMIN=/opt/subversion-1.9.4/bin/svnadmin
EMAIL=username_at_example.com
# $repos is a space-separated list of all the directories in
/home/svn/svn/repositories
for repo in $repos; do
#
# VERIFY ORIGINAL
----------------------------------------------------------------------
#
echo "***********************************************************
*********************"
echo "**** REPO $repo pre-backup sanity check
***************************************"
echo
"********************************************************************************"
svnadmin verify $repo || { mail -s "ERROR: SVN directory FATAL
error. This is a BIG problem. Backups are HALTED." $EMAIL < $LOGFILE; exit
1; }
#
# HOTCOPY
------------------------------------------------------------------------------
#
echo
"********************************************************************************"
echo "**** REPO $repo hotcopy
*******************************************************"
echo
"********************************************************************************"
rm -rf $HOTCOPYDIR/$repo.1
[[ -e $HOTCOPYDIR/$repo ]] && mv $HOTCOPYDIR/$repo
$HOTCOPYDIR/$repo.1
$RELIABLE_SVNADMIN hotcopy $REPODIR/$repo $HOTCOPYDIR/$repo || {
mail -s "ERROR: svn hotcopy exited with nonzero status." $EMAIL < $LOGFILE;
exit 1; }
echo
"********************************************************************************"
echo "**** REPO $repo hotcopy verify
************************************************"
echo
"********************************************************************************"
svnadmin verify $HOTCOPYDIR/$repo || { mail -s "ERROR: SVN hotcopy
error. The original is fine, hotcopy is not." $EMAIL < $LOGFILE; exit 1; }
#
# RSYNC
--------------------------------------------------------------------------------
#
echo
"********************************************************************************"
echo "**** REPO $repo rsync
*********************************************************"
echo
"********************************************************************************"
rm -rf $RSYNCDIR/$repo.1
[[ -e $RSYNCDIR/$repo ]] && mv $RSYNCDIR/$repo $RSYNCDIR/$repo.1
$RELIABLE_SVNADMIN freeze $repo -- rsync -av $repo $RSYNCDIR/ || {
mail -s "ERROR: rsync of svn repo $repo exited with nonzero status." $EMAIL
< $LOGFILE; exit 1; }
echo
"********************************************************************************"
echo "**** REPO $repo rsync verify
**************************************************"
echo
"********************************************************************************"
svnadmin verify $RSYNCDIR/$repo || { mail -s "ERROR: SVN rsync
error. The original is fine, rsync is not." $EMAIL < $LOGFILE; exit 1; }
echo
"********************************************************************************"
echo "**** Do other directories: authorization and bin
*******************************"
echo
"********************************************************************************"
cd $REPODIR/..
rm -rf $RSYNCDIR/authorization.1
[[ -e $RSYNCDIR/authorization ]] && mv $RSYNCDIR/authorization
$RSYNCDIR/authorization.1
rm -rf $RSYNCDIR/bin.1
[[ -e $RSYNCDIR/bin ]] && mv $RSYNCDIR/bin $RSYNCDIR/bin.1
rsync -av authorization $RSYNCDIR/
rsync -av bin $RSYNCDIR/
--
-Mike Schwager
Received on 2016-06-22 16:25:46 CEST