Automatic ZFS Snapshots and Backups
Posted by Dave Eddy on Dec 05 2015 - tags: techI recently made a new storage server to replace my old one
to keep up with my growing space requirements (I think 40T should hold me over
for a while!). I store all of my movies, music, tv shows, etc. on it, as well
as all of my backups. All of my laptops and desktop computers also backup to
this server using rsync
.
While it’s all stored on SmartOS using the ZFS filesystem in a raid setup that can handle 2 or more drive failures without data loss, it still worries me because it is all stored in one physical location: my closet. If there is a fire or some other disaster like that, all of my data could potential be lost.
To remedy this, I’ve repurposed the server I replaced (my old storage server) to be an off-site backup server that is used solely for ZFS receive. This server now runs FreeBSD, which you can read about in my blog post here
Automatic Snapshots
Before diving into my off-site backup solution, the first thing to talk about is how I handle automatic ZFS snapshots, and also removing snapshots as they get too old.
zfs-snapshot-all
https://github.com/bahamas10/zfs-snapshot-all
Recursively snapshot all zpools
I use this program to snapshot all zpools on my new storage server automatically in cron. My crontab looks something like this: