zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

Create Backups with tartarus

March 31, 2011 by Igor Drobot 2 Comments

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

Install tartarus on Debian squeeze: (works on ubuntu too)

Add the following line to:

1
2
deb http://wertarbyte.de/apt/ ./
vim /etc/apt/sources.list.d/wertarbyte.list

deb http://wertarbyte.de/apt/ ./ vim /etc/apt/sources.list.d/wertarbyte.list

1
aptitude update && aptitude install tartarus bzip2 curl

aptitude update && aptitude install tartarus bzip2 curl

Create tartarus general config:

1
vim /etc/tartarus/generic.inc

vim /etc/tartarus/generic.inc

Content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
}

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:

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

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

Create a backup operation:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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"

# 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:

1
tartarus /etc/tartarus/root.conf

tartarus /etc/tartarus/root.conf

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

1
tartarus -i /etc/tartarus/root.conf

tartarus -i /etc/tartarus/root.conf

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

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

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

Original – german

Filed Under: Debian, Linux, Networking Tagged With: backup, hetzner, hetzner backup, hetzner backup space, tartarus, tartarus debian squeeze

Categories

Archives

Tags

apache2 Apple arduino ARM Automation backup bash Cisco Cluster Corosync Database Debian Debian squeeze DIY DNS Fedora FTP Fun Icinga Ipv6 KVM Linux LVM MAC OS X Monitoring MySQL Nagios Nginx openSUSE OpenVPN PHP Proxy Python python3 qemu RAID rsync Samba security ssh Ubuntu virtualization Windows Windows 7 Wordpress

Comments

  1. Alexander says

    March 6, 2012 at 19:09

    Thank you for the description!

Trackbacks

  1. Incremental Remote (ftp) Backup | HostGator Coupons Code says:
    September 26, 2011 at 03:58

    […] Also in english Create Backups with tartarus « ID’s blog […]

Leave a Reply

Your email address will not be published. Required fields are marked *