rolling backup

Matthew Seaman matthew at
Mon Jan 25 11:05:59 UTC 2016

On 01/25/16 10:25, Sergei G wrote:
> Is there any good application for maintaining a rolling backup of
> filesystem?

There are several alternatives here, but the standout application
for system backups is bacula.

However I suspect that this will be way overkill for your purposes --
it's designed to backup whole networks of machines and needs its own
RDBMS in order to track backup state.

The trouble with backup software is that there is such a wide range of
requirements over all the different possible users that once you've
written a piece of software that is sufficiently flexible to support
just about any common usage (and do and the management of archiving,
backup cycling, indexing, restores etc. etc.) you will end up with a

If you want a small and neat script that does exactly what you want,
then your best approach is to write it yourself.

> I wrote this simple Makefile that's called from a periodic scripts to
> maintain backups.  However, over time it will run out of space. The
> solution would be to have the same backup reusing file names using a
> rolling backup scheme.  Is there a project that can do that already?

Hmmm.... is there any particular reason to use make(1) here?  You don't
appear to be utilizing any of the special features of make such as
creating an output file dependant on the ages of any input files.  It's
not that it's wrong to use make(1) like that, but it would be more usual
to write that as a shell script.  Probably slightly faster too, but I
expect the overhead from make(1) is lost in the noise compared to how
long it takes to run dump.

> In rolling backup I would be using parts of the date output (date -j
> +"%Y-%m-%d %H:%M:%S") and a mod operation to roll the number.  I just
> don't have time to spend on it...

Actually, I think your best bet is a small extension to your backup
script that just deletes all but the last N copies of the backup for a
particular filesystem.  Something like:

  ls -1t $(backupdir)/root_* | sed -e "1,$(N)d" | xargs rm

Deleting 'all but the last N' is a good strategy with backups.  Suppose
for whatever reason, backup fails for N nights in a row.  If you just
deleted backup files that were over N days old, you'ld be left without
any backups at all after a certain time.  However, keeping a certain
number of files means that you still have some backups available, albeit
older than would be ideal.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the freebsd-questions mailing list