Backup system overhual

Now I have more free time after completing most of my 6th form work, I can work on my list of things that I need to do on my main server, called mars.tchubb.co.uk. For all my backups I use rdiff-backup over an SSH session using SSH keys so the backup can run without human interaction. The system works great but the server I use to store the backups belongs to a friend of mine and does not have much hard drive space. The problem is that I sometimes I upload large ISO files that take up a large amount of backup space and they don’t really need to be backed up. These large ISO files are not all in one directory, so I want to configure a text file that I can add directories to be excluded.


Let’s get started with reconfiguring rdiff-backup! At the moment I am doing a backup of /home and excluding the directory rs-downloads which backs up every hour using cron job. Each time the backup runs the output will be dumped into a log file /var/log/home-backup.txt.

rdiff-backup -v5 --exclude /home//rs-downloads/home xxx@XX.XX.XX.XX::/home/xxx/home-backup_new > /var/log/home-backup.txt

First I am going to make some .txt files for the include and exclude directory lists and a directory so keep everything neat.

[root@mars ~]# mkdir ~/backup-configs
[root@mars ~]# cd ~/backup-configs
[root@mars ~]# touch include.txt
[root@mars ~]# touch exclude.txt

Also I will create a file to sort the rdiff-backup command in so I can just point cron to the file.

[root@mars ~]# touch backup-command
[root@mars ~]# vi backup-command
rdiff-backup --include '~/backup-configs/include.txt' –-exclude '~/backup-configs/exclude.txt' xxx@XX.XX.XX.XX::/home/xxx/home-backup_new > /var/log/home-backup.txt

Add the directories to the .txt and it should be good to go. All I need to do now is add it to cron to run on the hour every hour.

[root@mars ~]# crontab –e

And add a like:

@hourly ~/ backup-configs/backup-command

I am in the process of creating a full guide to setting up rdiff-backup on CentOS so check back soon!

This entry was posted in CentOS and tagged , , , . Bookmark the permalink.