Regular backups using dar
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
COPYING
README.md
__main__.py
archive.py
cleaner.py
config.py
darbup
errors.py
procwrite.py
rmpolicies.py
schedules.py
splice.py

README.md

darbup

Regular backups using dar

darbup is a wrapper around the excellent dar archiver tool.

Features

  • Schedule regular full and incremental backups to any mounted filesystem (e.g. external HDD)
  • Useful pre-canned policies for removal of old backups when configured space used by backups is exceeded
  • Fully configurable
  • Everything is logged

Requirements

  • dar
  • Python 3.3 or better
  • Linux

Finally, note that darbup is designed for backup to a mounted filesystem, not to online backup services. Having said that, if you can mount your online storage via something like sshfs, you should be able to use that.

Usage

$ git clone https://github.com/c4rlo/darbup.git && cd darbup
$ ./darbup
Default configuration file written to /home/carlo/.darbup/config, please customize
$ your_favourite_editor ~/.darbup/config

The generated config file has explanatory comments next to all the options.

Next, we install darbup as a cronjob, to ensure it gets executed regularly. If your system has anacron, you could use that; but be careful to ensure you run darbup as the desired user (i.e. probably not root).

However, when darbup is run, it first checks whether it needs to do anything, according to the configured schedule; if not, it just exits. Hence, there is no harm in running it more frequently than needed. Myself, I just set it to run every hour.

$ { crontab -l; echo '30 * * * * ionice -c 3 nice -17 /home/carlo/darbup/darbup'; } | crontab -

Some things to note here:

  • crontab is the program used to install per-user cron schedules (aka crontabs)
    • crontab -l lists the current crontab
    • crontab - installs a new crontab from stdout, replacing the existing one
  • nice -17 (part of coreutils) lowers the CPU scheduling priority for darbup
  • ionice -c 3 (part of util-linux) sets the I/O scheduling class for darbup to class 3, which is Idle

I use nice and ionice to ensure my system remains responsive during backups.

Restoring files from backup

darbup creates .dar archives. These can be extracted using the dar tool. For more information, see the dar documentation.

Note: .dar files created by darbup can be either full or incremental archives. These are distinguished by the presence of either "-full" or "-incr" in their filename. Incremental archives are always relative to the chronologically preceding archive (which may itself by incremental).

Author and license

darbup was created by Carlo Teubner. My email address is my first name, then a dot, then my last name, at gmail dot com.

darbup is Copyright 2013 Carlo Teubner. It is licensed under the GPL 3, which is reproduced in the accompanying file named COPYING.