Commit e803251f authored by Robert Ricci's avatar Robert Ricci

snappy-zfs 'client'

This client uses ZFS send and recieve to copy snapshots from a source
volume to a destination one

Too fragile right now
parent 0e608bbd
#!/bin/sh
ZFS=zfs
SRCVOL=$1
DSTVOL=$2
if ! [ ${1:+1} ]
then
echo "ERROR: Need source volume"
exit 1;
fi
if ! [ ${2:+1} ]
then
echo "ERROR: Need destination volume"
exit 1;
fi
SNAP=snappy-`date +%s`
VERS_OLD=`zfs list -H -r -t snapshot -o name zroot/usr/home/ricci | grep snappy-incremental | cut -d@ -f2 | sed "s/snappy-incremental-//" | sort -n | tail -1`
VERS_NEW=$(($VERS_OLD + 1))
INCR_OLD="snappy-incremental-$VERS_OLD"
INCR_NEW="snappy-incremental-$VERS_NEW"
zfs snapshot $SRCVOL@$INCR_NEW && zfs send -i $INCR_OLD $SRCVOL@$INCR_NEW | zfs recv $DSTVOL@$SNAP
# TODO: Remove source snapshot!
#!/bin/sh
ZFS=zfs
SRCVOL=$1
DSTVOL=$2
if ! [ ${1:+1} ]
then
echo "ERROR: Need source volume"
exit 1;
fi
if ! [ ${2:+1} ]
then
echo "ERROR: Need destination volume"
exit 1;
fi
zfs snapshot $SRCVOL@snappy-incremental-1 && zfs send $SRCVOL@snappy-incremental-1 | zfs recv $DSTVOL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment