Printable version
Simplified HTML, no CSS
Home

dbackup

    Status : stable
Download : dbackup (11 KB)

While searching for a backup tool, I didn't find anything between partition dumping and a plain tar invocation. I ended up doing a simple cp -auxf to backup the major parts of my system (/etc, /home, /var) to a trusted hard disk devoted to this task. However this was not satisfying.

Addendum : rsync and/or unison are actually killer tools that should do better than dbackup.

The problem

Every day the backup was overwritten with new data. As a result, the backup was containing the whole history, since files were never deleted from there. And of course you couldn't restore data from the backup properly : I once did it na´vely with a simple reverse copy, and I actually reinjected 6 months worth of mail spool that were still in the backup. The SMTP server became frantic and poured over 100 mail/sec over the LAN :).

I can't afford having multiple full copies of my backup. The minimum to make things safe is to keep the two last backups, and overwrite them cyclically. But you loose any content that was deleted more that two days ago. I need something tailored to my modest data and modest hard drives.

The solution

I need 1) a 'backup repository' which can be sync'ed exactly with my data, 2) a lenghty history of the data that was once on my hard disk. I wrote a Perl script that does this job. Let me define some terms :

dbackup -a /mnt/safe/homes-arc /home /root /mnt/safe/homes

This invocation will backup the sources '/home' and '/root' into the repository '/mnt/safe/homes'. When you sync the repository, any data which is in the repository but no longer among the sources is automatically moved to the archive '/mnt/safe/homes-arc' (the '-a archive' part is a dbackup option, see below). The tree structure is replicated in the archive, and files are renamed if necessary :

You end up with this directory layout :

Folder /mnt/safe/homes
  Folder home
   File (replication of /home content)
  Folder root
   File (replication of /root content)
Folder /mnt/safe/homes-arc
  Folder home
   File (archive/history of /home content)
  Folder root
   File (archive/history of /root content)

You can forget the '-a' (archive) option and work the old way, were the repository is a cumulative copy of your sources. You can also use '-d' to force an exact replication, meaning that it will delete repository items which are no longer among your sources (warning there !). You can also specify files as sources. Use '--help' for more information.

How it works

This is a recursive program, this algorithm is applied to every source path :

If you use the '-df' flag, you'll see letters explaining the decision for each node. Please use '--help' for more information.

Self documentation

sh: dbackup: command not found

Todo

Contact : Vincent Caron <v.caron@zerodeux.net> Last modified on Sunday 26 Jun 2005 17:11