*NOTE: Now replaced with Ubuntu NAS and Backup Server (NEW)
1. The Purpose (Mission)
- Automate home backups
- Forget about backup existence by scheduling
- Keep multiple versions, while minimizing backup size and time
- Old desktop PC running Ubuntu Server with two hard drives in RAID mirror configuration
- A modified version of Duplicati software running on each workstation
3. Progress Report
Naturally, at the beginning I didn't have a clear picture of how exactly my backup should function. The concept got refined during a research, when I was learning how other people did things. That's when I discovered Duplicati. Here are some of its features that I found essential:
- Incremental backup - minimizes bandwidth and backup time
- Keeps multiple versions of files - in case I wanted to go back a version or two
- Supports multiple server protocols - gives freedom of choosing backup location
- Client side encryption - for privacy and security
Everybody says that backup location should be as far away from the source as possible. Unfortunately, in my case, that means GBs of data sent over my broadband connection. I found it costly and prohibitive. One solution that seemed to be popular was sending a seed full backup to the storage location by snail-mail on a disk. Somehow this idea did not appeal to me. Especially since I wanted to do full backups periodically. So I settled on a compromise - my own backup server, located in my home, but totally under my control and costing me nothing (except for electricity).
The server choice became clear - Linux-based server box with SSH-protected access.
I had laying around at home an old Dell desktop PC, that was quite slow and useless, but otherwise functioning well. As it turned out, its built-in network adapter supported Wake-on-LAN, which proved to be quite useful later on for minimizing power consumption.
To solve the problem of "backing up the back up" I installed two identical 1TB drives running in RAID 1 mirror configuration. For that I purchased a PCI expansion card with several SATA connectors that also had support for RAID.
For the operating system of my server box, I went with Ubuntu, server edition. For two reasons, really: (1) it promised good performance on old/resource-limited hardware and (2) I wanted to play with Linux and learn it a bit. There are numerous guides out there that describe how to configure SSH on Ubuntu. Easy!
The trouble started when I wanted to implement an idea of putting Ubuntu box to sleep between backup sessions. No need to waste the energy, right? So here's how I did it:
1. created script keepawake.sh that checks to see whether any client is currently connected, and if not, invokes a shutdown:
2. added the following line to system crontab file that runs the above script periodically, every minute (my user name blanked-out):
to edit system crontab file, I used this shell command: sudo crontab -e
Right from the start, Duplicati was very quick and easy to install and I had my backup running in no time. The only problem still to be solved was to wake up server box at the start of backup. So, I decided to modify and recompile Duplicati from its source code http://duplicati.googlecode.com/svn/tags/1.3.4/ (I can't remember exactly why I didn't use trunk, but something didn't work for me there).
Using MS Visual Studio 2010 Express, I modified SSH backend library by adding a few controls to the configuration form:
As a result, after modifying a few other C# files and recompiling the solution, at the start of every backup, Duplicati sends out a WOL packet to my ubuntu box and wakes it up! The box, in turn, stays awake for as long as SSH connection is active and goes to sleep shortly after it terminates. Voila!
The complete modified source code I've uploaded to GitHub here: https://github.com/icboredman/Duplicati
as well as executable files: https://github.com/icboredman/Duplicati/tree/executable
P.S.: I still haven't figured out how to convert SVN distribution to GIT cleanly, while preserving all mod history, so unfortunately, I had to strip all but last modification info from the original Duplicati code (last rev 1.3.4) before putting in my changes (which I called rev 184.108.40.206).