On Sunday 13 January 2008 18:12:28 Philipp Marek wrote: > > > How about r1339? Here's the relevant part: > > > > Uncovers a different problem: > > No, I just made an error - modified an argument I shouldn't. [...] > Please try this *over* the other patch - it substitutes the lines:
It works!
With r1339 applied to 1.1.11 release, and then this patch applied on top
of that, the sample script (attached) backs up from snapshot using the
softroot approach, and when you're done, "fsvs status /" shows
that /the-only-dir/from-snapshot is gone.
I think that, in the DO_CHROOT=0 case, the binds list could be reduced
to:
binds="$BACKUP_PREFIX $BINDS"
So there are now two working approaches to using fsvs to back up from
LVM snapshots. :-)
The softroot approach is nice, because it will work for backups of
directory trees other than the root filesystem itself
(e.g. /home/sheldonh), and will work on platforms that don't have
mount --bind.
However, I'm likely to carry on using the chroot approach until I
understand softroot enough to trust it. :-)
Thanks,
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 /
binds="$BACKUP_PREFIX /etc/fsvs /var/spool/fsvs $BINDS"
for bind in $binds; do
mount --bind $bind $SNAP_MOUNT/$bind
done
# 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
chroot $SNAP_MOUNT fsvs commit $DEBUG -m 'Automatic backup'
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
for bind in $binds; do
umount $SNAP_MOUNT/$bind
done
# 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
signature.asc
Description: This is a digitally signed message part.
