Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2013 13:23:13 +0200
From:      George Kontostanos <gkontos.mail@gmail.com>
To:        freebsd-stable@freebsd.org
Subject:   Re: Musings on ZFS Backup strategies
Message-ID:  <CA%2BdUSyoAyzHc%2BgKcUbaFH1=9tb04Un99ptXD0T=9tUBDyyURTw@mail.gmail.com>
In-Reply-To: <5134D89E.3050004@gmail.com>
References:  <5130BA35.5060809@denninger.net> <5130EB8A.7060706@gmail.com> <2B318078-F863-4415-8DAE-94EE4431BF4C@ee.ryerson.ca> <5134C6C2.9020009@gmail.com> <1e4c24a68e76a279eaf4dc4f7c0156d3.squirrel@webmail.ee.ryerson.ca> <5134D89E.3050004@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I have found that the use of mbuffer really speeds up the differential
transfer process:

#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:

pool="zroot"
destination="tank"
host="1.2.3.4"

today=`date +"$type-%Y-%m-%d"`
yesterday=`date -v -1d +"$type-%Y-%m-%d"`

# create today snapshot
snapshot_today="$pool@$today"
# look for a snapshot with this name
if zfs list -H -o name -t snapshot | sort | grep "$snapshot_today$" >
/dev/null; then
echo " snapshot, $snapshot_today, already exists"
exit 1
else
echo " taking todays snapshot, $snapshot_today" | sendmail root
zfs snapshot -r $snapshot_today
fi

# look for yesterday snapshot
snapshot_yesterday="$pool@$yesterday"

if zfs list -H -o name -t snapshot | sort | grep
"$snapshot_yesterday$" > /dev/null; then

echo " yesterday snapshot, $snapshot_yesterday, exists lets proceed
with backup"

zfs send -R -i $snapshot_yesterday $snapshot_today | mbuffer -q -v 0
-s 128k -m 1G | ssh root@$host "mbuffer -s 128k -m 1G | zfs receive
-Fd $destination" > /dev/null


echo " backup complete destroying yesterday snapshot" | sendmail root

zfs destroy -r $snapshot_yesterday
echo "Backup done" | sendmail root
exit 0
else
echo " missing yesterday snapshot aborting, $snapshot_yesterday"
exit 1
fi


-- 
George Kontostanos
---
http://www.aisecure.net



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BdUSyoAyzHc%2BgKcUbaFH1=9tb04Un99ptXD0T=9tUBDyyURTw>