continuous backup solution for FreeBSD

Oliver Fromme olli at lurza.secnetix.de
Thu Oct 9 14:11:05 UTC 2008


Evren Yurtesen wrote:
 > Shaun Amott wrote:
 > > On Tue, Oct 07, 2008 at 12:31:58AM +0300, Evren Yurtesen wrote:
 > > > so FreeBSD could be supported also. As you can imagine, it is not only 
 > > > important that data can be restored when a box hardware failure etc. it is 
 > > > also important that data can be restored if deleted by accidents etc. While 
 > > > traditional backup programs provide this functionality, you cant really go 
 > > > back to 10 min or 1h ago, often they take daily backups and have to scan 
 > > > whole filesystem for changed files every time the backup is taken which 
 > > > stresses out the systems.
 > > 
 > > This can (more or less) be achieved with snapshots: you can cheaply
 > > maintain old versions of the file system, and mount an old snapshot at
 > > any time. Hourly is about as fine-grained as you can expect though.
 > 
 > The documentation says one cant do more than 20 snapshots.
 > http://www.freebsd.org/doc/en/books/handbook/snapshots.html

I wouldn't use UFS snapshots for this purpose.  They have
a few well-known disadvantages.

However, ZFS snapshots should work very well for this.
They're not limited to 20, and you can create them very
quickly and with low overhead.  You could create a new
snapshot every 5 minutes if you want.

Then you can use the "zfs send" command to produce a
stream that contains the incremental differences between
the snapshot and the previous snapshot, i.e. the stream
represents the changes to the filesystem within the past
five minutes (or whatever snapshot interval you choose).

You can store that stream in a file, on backup medium,
or send it with ssh to a different continent.  Every once
in a while you should make a full backup from a snapshot,
of course.

Basically it works like any other incremental backup
mechanism, except that you can make the time interval
between incremental backups very small (like five minutes
in the above example), so you get a nearly continous
backup solution.

By the way, if you accidentally deleted something, you
can of course simply copy it back from a snapshot.  You
can even revert the whole file system to a previous
snapshot using the "zfs rollback" command.  This is
like going back in time.  There is no need to touch
your backups for that.

These features are readily available right now on FreeBSD.
You don't have to code anything.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"UNIX was not designed to stop you from doing stupid things,
because that would also stop you from doing clever things."
        -- Doug Gwyn


More information about the freebsd-hackers mailing list