[nycbug-talk] zfs backup scripts?

Charles Sprickman spork at bway.net
Sat Jan 16 01:28:38 EST 2010


On Sat, 9 Jan 2010, Isaac Levy wrote:

> On Jan 9, 2010, at 12:17 AM, Charles Sprickman wrote:
>
>> On Fri, 8 Jan 2010, Isaac Levy wrote:
>> 
>>> Hi Charles,
>>> 
>>> On Jan 8, 2010, at 3:26 AM, Charles Sprickman wrote:
>>> 
>>>> Howdy,
>>>> There's lots of stuff out there, but I'm looking for something that 
>>>> basically works like "rsnapshot", but rather than doing all the linking 
>>>> magic rsnapshot does, it uses zfs snapshots (and has a nice retention 
>>>> config for daily/weekly/yearly snapshots)...
>>>> Has anyone found such a beast?  This might very well be a case of 
>>>> everyone rolling their own, as that's what I'm tempted to do at this 
>>>> point, and I'm not a big fan of writing something when it already exists.
>>>> Thanks,
>>>> Charles
>>> 
>>> 
>>> Been using ZFS for both our NFS servers and backup machines, and we rolled 
>>> our own scripts to snapshot the volumes, pulled from cron.
>> 
>> OT a bit, but FreeBSD or Solaris?
>
> FreeBSD 7.1 (very conservative builds), and we're slowly moving the storage 
> systems to 8.0, where ZFS is no longer listed as 'experimental'.
> All on huge greybox Intel hardware.
>
>> Are you happy with the stability of the whole kit and kaboodle?
>
> Absolutely.
>
>> 
>>> The hardest part was getting people various groups to come clean on their 
>>> backup needs, so we could get the frequency vs. storage needs to fit our 
>>> budget.
>> 
>> That I'm OK with.  What I hate is any type of perl or shell script that has 
>> to deal with days, weeks, months and years.  I've got a serious mental 
>> block on that stuff.. Most of my time hacking this mess together will be 
>> looking for perl modules I imagine.
>
> I believe we did it all in shell scripts without much grief, and any perl we 
> use has no add-on modules.
>
>> 
>> I am finding a TON of "rolling snapshot" scripts, but I really want to come 
>> closer to emulating a good old-fashioned backup setup that lets me keep X 
>> yearly, Y monthly, Z weekly and ZZ daily sets of backups.  Gnash gnash 
>> gnash.
>
> May I suggest dropping shell scripts into /etc/periodic/daily , weekly , 
> monthly?
>
> Reliable, portable, easy- IMHO.

Well, here's what I've come up with so far.  It's getting a trial this 
week and then off to the co-lo with it.  I'll just do a little brain dump 
here for anyone interested, since I think I'm now a ZFS fanboy.

First off, I had no budget.  This was going to be made with 4 1TB WD RE3 
drives (about $660) and some leftover hardware.  Long story short, getting 
the scraps together was going to cost about as much as buying some new 
parts anyhow.  Here's my parts list:

$164 - Supermicro server-class board w/6 SATA ports onboard, serial 
console redirection, etc. model # X7SBL-LN1 (splurge!)
$110 - 4GB ECC RAM (damn cheap for ECC, and yes more RAM would be better)
$45 - Mini tower case and some fans, very cheap, but nice drive mounting 
and good airflow around the drives
$45 - 500W power supply
$62 - 2.4GHz dual-core Celeron
$0 - FreeBSD/amd64 8.0

So a bit over $1100 for a box with 4TB of raw storage, and money spent 
where it counts (RE3 drives, ECC RAM, server mobo).

Since I'm not totally comfortable with a ZFS boot, I took the first two 
drives and made a 40GB slice on each for the OS, then mirrored them with 
gmirror.  The remainder of the space goes into a RAIDZ pool for about 
2.5TB of usable space.  Performance is better than I expected, I measured 
about 125MB/s writes and 142MB/s reads off the zfs pool - very good for 
only 4 drives doing software RAID on a celeron with a filesystem not 
known as a speed demon, IMHO.

For backing stuff up, I used this set of scripts as a base:

http://forums.freebsd.org/showthread.php?t=3689

It seems relatively sane, looks like a great base to build on, and I like 
the simple config layout and parallel backups across multiple sites or 
groups of machines.

To rotate out old snapshots and manage my retention, I'm playing around 
with this:

http://www.scottlu.com/2009/04/managing-zfs-snapshots.html

It seems like many people opt for a continuous set of "rolling" snapshots. 
Since I'm backing up a bunch of stuff that changes quite a bit each day 
(email is the bulk of the space), that's not totally practical.  I need to 
emulate a more traditional yearly, monthly, weekly and daily rotation to 
save space.

I highly encourage anyone who's ever been curious about zfs to bring up an 
8.0 box and screw around with it.  There are lots of things to like, my 
favorite so far is really the simplicity of setting it up.  I've played 
with vinum, took a stab at Linux's LVM, and this is really simple.  I 
think making the volume manager and the filesystem one big lump managed 
with only two binaries is ZFS' biggest asset.  Snapshots, checksumming of 
data, the ease of adding more drives, and the send/recv stuff are just 
icing on the cake.

Charles


> Rocket-
> .ike
>
>
>
>> 
>> C
>> 
>>> Best,
>>> .ike
>>> 
>>> 
>> 
>



More information about the talk mailing list