Linux home server software – part 4 – Backup

I was looking for a highly effective way to backup the servers system drive, which simply resides on a USB thumbdrive (see Software – part 1). Finally I came up using a tool named „linuxclone“, which copies the whole system to another thumbrive and makes it bootable. Find it here: http://fex.belwue.de/linuxclone.html

I use rsnapshot to create a backup of the data stored on the server. rsnapshot uses a configuration file, located in /etc/rsnapshot.conf. This is where you set up where to store the backups, how much iterations of data you’d like to keep and what should be included in the backup.

I do monthly backups, with the backup drive stored offsite. This means, when I connect the drive, I want an easy way to start the process. I created a little script named „srvbackup“ which mounts the drive, does the backup, unmounts and tells me what going on:

#!/bin/bash
echo "Mounting backup volume"
mount /mnt/srvbackup
echo "Starting backup"
sudo rsnapshot daily
echo "Backup finished, unmounting backup volume"
umount -l /mnt/srvbackup
echo "All done"
exit 0

Put the script in your /bin/ folder and make it executable

sudo chmod 755 /bin/srvbackup

Afterwards you can simply start it by typing sudo srvbackup on your console.