Backupninja: the ultimate data defender

November 1st, 2009 edited by Tincho

Article submitted by Андрей Парамонов (Andrey Paramonov). DebADay needs you more than ever! Please submit good articles about software you like!

Everyone knows they should do regular backups. Sooner or later, your hardware will fail, or you will accidentally delete a directory, or something else will happen.

Many people, however, ignore periodic backups because they find it too much of a hassle. That’s why, the backup procedure must be fully automated and require no user intervention, at all.

Backupninja is a backup system that provides excellent automation and configuration facilities. You only need to instruct Backupninja once, and he will take silent duty of defending your valuable data. This can be done via direct edit of configuration files, or via a nice console wizard called ninjahelper, which also helps to test the backup actions interactively.

Backupninja doesn’t do the hard work himself, but rather relies on specialized tools like rdiff and duplicity, thus following the Unix-way. There is built-in support for specialised backup actions, including things like the backup of Subversion repositories, or LDAP, MySQL, and PostgreSQL databases. It can do remote, incremental backups, as well as burning them to CDs or ISO images.

But the best part is that Backupninja is capable of learning new powerful skills, just by reading user-provided shell scripts. For example, I use the following script to dump important package information of my Debian system:


dpkg --get-selections > /var/backups/dpkg-selections
if [ $? -ne 0 ]
   error “dpkg selections dump failed”
   info “dpkg selections dump done”

aptitude search -F %p ‘~i’ > /var/backups/apt-installed && \
aptitude search -F %p ‘~i!~M’ > /var/backups/apt-installed-manual && \
aptitude search -F %p ‘~i ~M’ > /var/backups/apt-installed-auto
if [ $? -ne 0 ]
   error “installed package list dump failed”
   info “installed package list dump done”

Note the use of some special functions: debug, info, and error. They put descriptive messages into the log file. It allows me to quickly ensure that fresh backups have actually been created. I’ve been using Backupninja to backup my personal data for a long time.


  • Fully automates the backup procedure
  • Is very easy to setup
  • Is very flexible


  • Build-in functionality could support more features
  • Support for non-shell backup scripts is limited

The backupninja package has been available in Debian since etch, and in Ubuntu since Dapper.

Posted in Debian, Ubuntu |

2 Responses

  1. tsakf Says:

    This article has been added to the library.

  2. Henryk Gerlach Says:

    If you are at it: Shouldn’t you also offer a restore script, which restores the system from /var/backups/apt-* ?

    Only when you actually restored the system once, you know, that your approach really works. :)