Create Backups with tartarus

If you have a FTP backup space for your vserver or dedicated server, tartarus is a great tool to create and crypt your backups.

Install tartarus on Debian squeeze: (works on ubuntu too)
Add the following line to:

deb http://wertarbyte.de/apt/ ./
vim /etc/apt/sources.list.d/wertarbyte.list
aptitude update && aptitude install tartarus bzip2 curl

Create tartarus general config:

vim /etc/tartarus/generic.inc

Content:

STORAGE_METHOD="FTP"   # FTP-Server
STORAGE_FTP_SERVER="hetzner.de"   # FTP-Account
STORAGE_FTP_USER="username"
STORAGE_FTP_PASSWORD="password123"   # Compression
COMPRESSION_METHOD="bzip2"   # Symmetric encryption
ENCRYPT_SYMMETRICALLY="yes"   # Read pass phrase from
ENCRYPT_PASSPHRASE_FILE="/etc/tartarus/backup.sec"   # While creating backup don't use more space than available
STAY_IN_FILESYSTEM="yes"   # Cleanup hook for old backups
TARTARUS_POST_PROCESS_HOOK() {
    echo -n "$STORAGE_FTP_PASSWORD" | /usr/sbin/charon.ftp \
    --host "$STORAGE_FTP_SERVER" \
    --user "$STORAGE_FTP_USER" --readpassword \
    --maxage 7 \
    --dir "$STORAGE_FTP_DIR" --profile "$NAME"
}   # Logging to syslog
TARTARUS_DEBUG_HOOK() {
    echo $DEBUGMSG | logger
}

Create a file with your pass phrase:

cat /etc/tartarus/backup.sec
hONj14Mg1h6sHzIBPBcV
# generate a key with pwgen -s 20

Create a backup operation:

# Read main config
source /etc/tartarus/generic.inc   # Profile name
NAME="root"   # What to backup
DIRECTORY="/"   # To exlude
EXCLUDE="/tmp/ /proc/ /sys/ /var/tmp/ /var/run/"   # No LVM snapshot
CREATE_LVM_SNAPSHOT="no"   INCREMENTAL_TIMESTAMP_FILE="/var/spool/tartarus/timestamps/root"

Start your first backup:

tartarus /etc/tartarus/root.conf

After a full backup you are free to start a incremental backup:

tartarus -i /etc/tartarus/root.conf

To be able to create incremental backups, you need to create this directory:

mkdir -p /var/spool/tartarus/timestamps/

Leave a comment