On Mon, Apr 23, 2007 at 05:19:32PM -0600, Steven Willoughby wrote:
I think it is possible to combine rdiff-backup and LVM snapshots to
have incremental backups on the same machine without having two full
copies of the data set.
It's not even very tricky to set up:
#!/bin/sh
#set -x
set -e
echo "rdiff-backup"
host=leghorn
snapname=/dev/r1vg/homesnap
remove_snapshot() {
umount $snapname || echo 'unmounted already'
if lvs $snapname > /dev/null 2>&1 ; then
lvremove -f $snapname
fi
}
if ping -q -c 3 $host > /dev/null; then
remove_snapshot
lvcreate -L 2G --snapshot --name homesnap /dev/r1vg/home
mount $snapname /mnt/home_ro
ssh $host mount -t ext3 /dev/b1/rdbackup /mnt/rdbackup || echo 'already
mounted'
rdiff-backup --print-statistics /mnt/home_ro $host::/mnt/rdbackup/home
rdiff-backup --force --remove-older-than 1M $host::/mnt/rdbackup/home
ssh $host umount /mnt/rdbackup
remove_snapshot
else
echo "Can't backup to $host; unreachable"
fi