backup2l is a lightweight command line tool for generating,
maintaining and restoring backups on a mountable file system (e.
g. hard disk). The main design goals are are low maintenance
effort, efficiency, transparency and robustness. In a default
installation, backups are created autonomously by a cron script.
backup2l supports hierarchical differential backups with a
user-specified number of levels and backups per level. With this
scheme, the total number of archives that have to be stored only
increases logarithmically with the number of differential
backups since the last full backup. Hence, small incremental
backups can be generated at short intervals while time- and
space-consuming full backups are only sparsely needed.
The restore function allows to easily restore the state of the
file system or arbitrary directories/files of previous points in
time. The ownership and permission attributes of files and
directories are correctly restored.
An integrated split-and-collect function allows to comfortably
transfer all or selected archives to a set of CDs or other
All control files are stored together with the archives on the
backup device, and their contents are mostly self-explaining.
Hence, in the case of an emergency, a user does not only have to
rely on the restore functionality of backup2l, but can - if
necessary - browse the files and extract archives manually.
For deciding whether a file is new or modified, backup2l looks
at its name, modification time, size, ownership and permissions.
Unlike other backup tools, the i-node is not considered in order
to avoid problems with non-Unix file systems like FAT32.
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.8kB of archives.
After unpacking 143kB of additional disk space will be used.
Get:1 http://mirror.ox.ac.uk stable/main backup2l 1.4 [29.8kB]
Fetched 29.8kB in 0s (44.7kB/s)
Selecting previously deselected package backup2l.
(Reading database ... 34584 files and directories currently
Unpacking backup2l (from .../archives/backup2l_1.4_all.deb) ...
Setting up backup2l (1.4) ...
This will complete the installation.
If you want to know more options check backup2l
The default configuration file is located at
You need to change the some of the parameters to work for your
You need to enter the list of directories you want to backup
under this list
# List of directories to make backups of.
# All paths MUST be absolute and start with a '/'!
SRCLIST=(/etc /root /home /var/mail /usr/local)
the above example is showing /etc /root /home /var/mail /usr/local
directories are taking backup
You need to enter the list of directories you want to exclude
from backup under this list
# This example skips all files and directories with a path name
# '.nobackup' and all .o files:
SKIPCOND=(-path "*.nobackup*" -o -name "*.o")
the above example we are excluding /var/www/domains/*/logs/*/
You need to mention the Destination directory for backups
# Destination directory for backups;
# it must exist and must not be the top-level of BACKUP_DEV
the above example /home/backup is the destination directory
Backup Parameters list
# Backup parameters
# Number of levels of differential backups (1..9)
# Maximum number of differential backups per level (1..9)
# Maximum number of full backups (1..8)
# For differential backups: number of generations to keep per
# old backups are removed such that at least GENERATIONS *
# recent versions are still available for the respective level
# If the following variable is 1, a check file is automatically
If you want to menction pre and post backup scripts you need to
enter the following section
# Pre-/Post-backup functions
# This user-defined bash function is executed before a backup is
echo " pre-backup: nothing to do"
# e. g., shut down some mail/db servers if their files are to be
# 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
# This user-defined bash function is executed after a backup is
# e. g., restart some mail/db server if its files are to be
echo " post-backup: nothing to do"
This is very useful whenevery you want to take a backup of you
databases or you need to run something before starting back or
after finishing backup
Now finally we need to make sure the
crontab entry for backup2l
By default backup2l installation will copy a script in /etc/cron.daily
folder with the file name zz-backup2l
If you want to see the file contect as follows
# The following command invokes 'backup2l' with the default
# file (/etc/backup2l.conf).
# (Re)move it or this entire script if you do not want automatic
# Redirect its output if you do not want automatic e-mails after