Backup or snaphot tool for ext4

backupext4

I'm looking for a backup tool for ext4 which can take a copy from a running filesystem like /var with no collisions in the system after recovering such a filesystem. I know BSD dump has an '-L' option, which tells him to work on a snapshot. But neither dump nor dumpe2fs from repositories have such an option. I've read about a patchset for ext4 providing snapshot support, but replies about it are very different, so I'm here to ask about your experience with this patchset.

Best Answer

dump does not need a switch to work on a snapshot. Just make the snapshot with LVM, and dump it.

I have a nightly cron job that does just that, using a 5 level tower of hannoi backup pattern. This means I only have to do a full backup every several months when I feel like the level 1 dumps dumps are getting too large. Level 1 dumps are made on the 1st and 17th of the month.

#!/bin/bash
set -e
declare -a LEVELMAP=(1 5 4 5 3 5 4 5 2 5 4 5 3 5 4 5 1 5 4 5 3 5 4 5 2 5 4 5 3 5 4 5)
DATE=`date +%-d`
LEVEL=${LEVELMAP[$DATE-1]}
echo Performing a level $LEVEL dump
/etc/init.d/apache2 stop
sync
lvcreate -s -n snap vg0/root -L 400m
/etc/init.d/apache2 start
dump -$LEVEL -quz9 -b 1024 -f /backup/dump.$LEVEL /dev/mapper/vg0-snap
lvremove -f vg0/snap
Related Question