User Tools

Site Tools


setting_up_backup2l_with_debian

Setting up backup2l with Debian

Installation and configuration

  • 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
BACKUP_DIR="/var/backups/localhost"

# Pre-/Post-backup functions

# This user-defined bash function is executed before a backup is made
PRE_BACKUP ()
{
    # 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
POST_BACKUP ()
{
    # Sync to external backup space
    rsync --delete -qazr /var/backups/localhost  example.backup.example.co.uk::example/
}

# Remove this line after the setup is finished.
UNCONFIGURED=0

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

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

https://forum.bytemark.co.uk/comments.php?DiscussionID=1771

Restoring from backups

References

setting_up_backup2l_with_debian.txt · Last modified: 2018/12/06 20:21 by abeverley