[vox-tech] Incremental CD backups
Ken Bloom
kbloom at gmail.com
Mon May 1 21:13:20 PDT 2006
I just discovered the -root and -old-root options of mkisofs for
creating incremental backups, and so I hacked together a scropt for
creating said backups, which I'm attaching here for your scrutiny and
use.
The subversion repository in /home/bloom_svn is an FSFS repository. I
don't think you'll get a space savings if you're using a BDB
repository, but I'm no expert.
One of my big goals in creating a script like this was to be able to run
a few commands on the repository once it was backed up to CD to insure
the integrity of the backup. Now I can accomplish that goal
automatically as part of the backup script.
--Ken
----8<---------------------
#!/bin/bash
CDDEV=/dev/cdrom
#COLLECT DATA
[ -a /tmp/kenbackup ] && rm -rf /tmp/kenbackup
mkdir /tmp/kenbackup
ln -s /home/bloom_svn /tmp/kenbackup/subversion
ln -s /home/bloom/Maildir /tmp/kenbackup/Maildir
#MKISOFS
if [ -a /cdrom/backup-1 ]; then
OLDVERSION=$(ls /cdrom --sort=time | head -n 1 | \
sed -e 's at backup-@@')
VERSION=$(( $OLDVERSION + 1 ))
umount /cdrom
MSINFO=$(cdrecord -msinfo dev=$CDDEV 2> /dev/null)
mount /cdrom
mkisofs -o /tmp/backup.iso -root backup-$VERSION \
-old-root backup-$OLDVERSION \
-f -J -l -r -C $MSINFO -M $CDDEV \
/tmp/kenbackup
else
VERSION=1
mkisofs -o /tmp/backup.iso -root backup-$VERSION \
-f -J -l -r /tmp/kenbackup
fi
#CDRECORD
umount /cdrom
cdrecord -v -multi -tao dev=$CDDEV -data /tmp/backup.iso
mount /cdrom
#VERIFY
echo Please verify that these results look correct:
echo ================================================
echo Running: svn ls file:///cdrom/backup-$VERSION/subversion
svn ls file:///cdrom/backup-$VERSION/subversion
echo ================================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://ns1.livepenguin.com/pipermail/vox-tech/attachments/20060501/eaba8e79/attachment.pgp
More information about the vox-tech
mailing list