Warning: Trying to access array offset on value of type bool in /data/www/freeminded.org/www/wp-content/plugins/wp-latex/wp-latex.php on line 39 Backup using backup2l and rsync @ Freeminded.org Warning: Trying to access array offset on value of type bool in /data/www/freeminded.org/www/wp-content/plugins/wp-latex/wp-latex.php on line 46

Backup using backup2l and rsync

This entry was posted by on Wednesday, 5 May, 2010 at

Say you have a workstation on which you have some valuable data (say, a Master’s Thesis 🙂 and you would like to have it automatically backup to a remote server. There are some excellent howtos out there on the web so I won’t go into too much detail, I will just report on how I did it.

On the server:

  1. make sure you install backup2l (available in most repos, (K)Ubuntu for sure).
  2. edit /etc/backup2l.conf to reflect your preferences:

    Contains a space-separated list of paths you want to backup. /etc an /root are common, but you may also want to backup your /home/[username] directory.


    This tells backup2l to dump all files in a local dir called backup. We use this as a staging area, we’ll move files to a safe location later on.


    This defaults to DRIVER_TAR_GZ, but I find the SPLIT version easier because you will get multiple (smaller) files in stead of one big one. The size of the chunks can be edited in this line in the DRIVER_TAR_GZ_SPLIT definition:

    tar cz -T $4 --no-recursion | split --bytes=725100100 - ${3}/part_

    Of interest here is the –bytes=xxxx part. This creates files the size of a CD.
    After saving the file backup2l will periodically start to archive files.

  3. The next step is to move the archives away to a safe location – backups on the same PC (or even on the same drive…) are not very safe from crashes, fire, flooding, burglars and the like. We use rsync to do this. On my PC at home I have a cronjob which periodically synchronises the BACKUP_DIR on my workstation with the copy at home.
    rsync -v --progress --stats --compress --rsh=/usr/bin/ssh \
          --recursive --times --perms --links --delete -e "ssh -i /home/grabthar/.ssh/id_rsa" \
          grabthar@turbodyne25.zonix.nl:/local/backup/ /media/sdd1/backup/turbodyne25

    This probably deserves some explanation. The –rsh tells rsync to connect using a secure shell, and -e “…” tells it where to find the rsa certificate to connect without having to supply a password all the time. Excellent howtos exist on how to ssh without password (just search for it). You can see I am rsyncing the /local/backup directory on turbodyne25 to a local drive at /media/sdd1/backups.

  4. Some points of interest:
    • Use the “-n” and “-v” arguments while experimenting with rsync. This will perform a dry run (-n) or be verbose, both of which can be very useful.
    • The “–delete” argument removes files on the destination which have been removed at the source. So old archive files which have been cleaned up by backup2l will, in due time, also be removed by rsync on the remote backup location. Be sure to specify your source path with “path” or “path/” and not “path/*” when using the –delete option, otherwise rsync will not delete anything because the wildcard operator (*) will expand to anything and as such remove nothing.

I hope this is useful information.


  1. NAS: Ubuntu Server on Intel ATOM @ Freeminded.org

Leave a Reply