Recently i made “the switch”! Not in the way you might imagine though. Ever since 2003 i have been a passionate mac user. I still use macs at home and work and am still passionate about them.
Before 2003 i was playing a lot of games. Linux was and is something that i have been working/playing around with since 1996. To make a long story short: I wanted to use Linux and also play games (read dual boot linux/windows). The price tags on new macs ware also something that got me thinking about building a new shiny i7 based PC.
I am now back on a PC with Ubuntu Linux 9.04 and Windows 7. So far so god. One thing that i enjoy with Linux is that i am able to customize it to my needs. With Linux now being my primary OS (by choice) i had to fix some kind of backup for photos and all that other stuff on my PC that i would not like to loose in case of an accident. The first thing that came to my mind was rsync.
I used rsync to mirror my files on to an usb-disk. But after a few days i started to miss Time Machine which i was using when i had a Mac as my primary computer at home. Just mirroring files was not enough to give me that warm and cozy feeling. I needed to go back in time!
As a Linux user you can choose between a vast amount of backup solutions. But hey, where is the fun in that?! So i decided to make my own backup proggie. Just for fun and at the same time i also had a learning experience (i like Linux, can you tell?).
The backup script i wrote takes incremental backups with links to different directories, just like Time Machine does. You can delete old backup directories as you please. Restore files by copying them and so on.
If you are interested in a simple, yet useful backup solution for Linux feel free to use the code below.
# Thorsten Rhau
# Backup for Linux with rsync
# What we want to backup
# Where we want to backup
# What NOT to backup
### DO NOT EDIT BELOW THIS !
# Testign if the destination directory exists
if [ ! -d $DESTINATION ]; then
echo backup destination does not exist, please create it >&2
# Testing if the 'rsync' command is on your system
if [ -z $RSYNC ]; then
echo could not find rsync on your system >&2
# Generating a string of things to exclude
for a in $EXCLUDE; do
EXCLUDESTRING="$EXCLUDESTRING --exclude $a "
# Executing 'rsync' as root to perform the backup
sudo rsync -aP --link-dest=$DESTINATION/current $EXCLUDESTRING \
sudo rm "$DESTINATION"/current
sudo ln -s $DESTINATION/backup-$DATE $DESTINATION/current