Backup Manager

Backup Manager is a perl script designed to backup and optionally encrypt filesystems and databases.

Checklist

  • ✔ root mysql user, with password in .my.cnf
  • ✔ use –defaults-extra-file=/root/.my.cnf in mkconfig
  • ✔ don't use tarball-incremental, backup-manager will symlink to old archives if they match

Configuration

There is a template file installed at /usr/share/backup-manager/backup-manager.conf.tpl

The most common variables you would want to change are:

# Where to store the archives
export BM_REPOSITORY_ROOT="/var/archives"

# Number of days we have to keep an archive (Time To Live)
export BM_ARCHIVE_TTL="5"

# The backup method to use.
# Available methods are:
# - tarball
# - tarball-incremental
# - mysql
# - pgsql
# - svn
# - pipe
# - none
# If you don't want to use any backup method (you don't want to
# build archives) then choose "none"
export BM_ARCHIVE_METHOD="tarball"
Encryption
# Uncomment the following line if you want to enable encryption
# export BM_ENCRYPTION_METHOD="gpg"

# The encryption will be made using a GPG ID
# Examples:
# export BM_ENCRYPTION_RECIPIENT="0x1EE5DD34"
# export BM_ENCRYPTION_RECIPIENT="Alexis Sukrieh"
# export BM_ENCRYPTION_RECIPIENT="sukria@sukria.net"
Incremental Tarballs
# Which frequency to use for the master tarball?
# possible values: weekly, monthly
export BM_TARBALLINC_MASTERDATETYPE="weekly"

Gotchas

backup-manager and ~/.my.cnf

backup-manager will use the defaults from ~/.my.cnf because when it is running mysqldump it is adding –defaults-extra-file, which adds to the defaults it already finds.

In that case, if you have something like username in the personal configuration, it will use that along with it's extras file.

I suppose technically it could be a MySQL bug, since -u<user> does not override the config file.

Backup Manager also creates a temporary file at ~/.backup_manager-my.cnf which it uses with mysqldump. If you have database connection errors, make sure that file is deleted, as it may have old information.

Probably the simplest way to do backups, if running as root, is to just use the same credentials located in the user's config file. Another option is to create a new user to run the process of archival and storage, but that would require the user to have read permissions to other users' files.

cron and mkconfig

When running mkconfig with cron, vixie-cron ignores the ~/.my.cnf file for some reason. Add –defaults-extra-file=/root/.my.cnf to the command to dump databases.

Blacklist

Here's some files to exclude when backing up:

export BM_TARBALL_BLACKLIST="*~ Network\ Trash\ Folder .recycle /dev /sys /proc /tmp .AppleDouble lost+found .DS_Store ._* :2eTemporaryItems rdiff-backup-data .AppleDB .AppleDesktop zarchive"