Setting up backup2l with Debian

From Andywiki
Jump to: navigation, search

Installation and configuration[edit]

  • Install the package:
apt-get install backup2l
  • Edit the configuration file (/etc/backup2l.conf). You will need to change the following:
# List of directories to make backups of.
# All paths MUST be absolute and start with a '/'!
SRCLIST=(/etc /root /home /var/mail /usr/local)

# Destination directory for backups;
# it must exist and must not be the top-level of BACKUP_DEV

# Pre-/Post-backup functions

# This user-defined bash function is executed before a backup is made
    # On a Debian system, the following statements dump a machine-readable list of
    # all installed packages to a file.
    echo " writing dpkg selections to /root/dpkg-selections.log..."
    dpkg --get-selections | diff - /root/dpkg-selections.log > /dev/null || dpkg --get-selections > /root/dpkg-selections.log

    # Dump mysql databases. Watch the permissions on this file if entering passwords!
    echo "  Dumping all mysql databases..."
    /usr/bin/mysqldump -uexample -pexample --all-databases --single-transaction > /root/all_databases.sq    


# This user-defined bash function is executed after a backup is made
    # Sync to external backup space
    rsync --delete -qazr /var/backups/localhost

# Remove this line after the setup is finished.

By default backup2l will run with the zz-backup2l script in /etc/cron.daily

To reduce the IO load of the backups, it can be edited as follows:

! which backup2l > /dev/null || nice -n 19 ionice -c 3 backup2l -b

Controlling backups[edit]

The following page gives details of fine-tuning the backup frequency settings:

Restoring from backups[edit]

See examples at