On Saturday 12 January 2008 14:40:22 Philipp Marek wrote:
> What I meant was to give $SNAP_MOUNT as parameter on commit *only* -
> so that FSVS knows what should be committed.

So you just want $SNAP_MOUNT added as an argument to the fsvs 
command-line in the run script?  Doesn't produce great results.  It 
only backups up the $SNAP_MOUNT directory and its parent, none of the 
contents.

Results tarball (and modified run script) attached.

Ciao,
Sheldon.
#!/bin/sh -x

DO_CHROOT=0

DEBUG="-d"
BACKUP_PREFIX=/media/backups
BINDS=/boot
ROOT=/dev/vgr1/root
SNAP=/dev/vgr1/rootsnap
SNAP_SIZE=1G # See lvcreate(8)
SNAP_MOUNT=`mktemp -d /tmp/fsvs.XXXXXX` # Should be in an ignored directory

depth_of () {
        path=$1
        
}

errx () {
        echo $* 1>&2
        exit 1
}

set -e

lvcreate -s -L $SNAP_SIZE -n rootsnap $ROOT
mkdir -p $SNAP_MOUNT
mount $SNAP $SNAP_MOUNT
cd /

# DEBUG: proving that the backup is taken from the snapshot
sleep 2
ls -ld $SNAP_MOUNT/the-only-dir
[ -e $SNAP_MOUNT/the-only-dir ] && touch $SNAP_MOUNT/the-only-dir/from-snapshot
ls -ld $SNAP_MOUNT/the-only-dir

set +e
if [ "$DO_CHROOT" = "1" ]; then
        binds="$BACKUP_PREFIX /etc/fsvs /var/spool/fsvs $BINDS"
        for bind in $binds; do mount --bind $bind $SNAP_MOUNT/$bind; done
        chroot $SNAP_MOUNT fsvs commit $DEBUG -m 'Automatic backup'
        for bind in $binds; do umount $SNAP_MOUNT/$bind; done
else
        # Take care; this assumes that SNAP_MOUNT/../.. is the root directory
        FSVS_CONF=$SNAP_MOUNT/../../etc/fsvs \
        FSVS_WAA=$SNAP_MOUNT/../../var/spool/fsvs \
            fsvs commit $DEBUG -m 'Automatic backup' \
                               -o softroot=$SNAP_MOUNT \
                               $SNAP_MOUNT
fi
set -e

# Also back up fsvs config and working copy administrative area
rsync -avI /etc/fsvs/ $BACKUP_PREFIX/system-fsvs.conf/
rsync -avi /var/spool/fsvs/ $BACKUP_PREFIX/system-fsvs.waa/

cd /
umount $SNAP_MOUNT
rmdir $SNAP_MOUNT
lvremove --force $SNAP

Attachment: with-softroot-1.tar.gz
Description: application/tgz

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to