Tuesday 5 October 2010

Bacula - The Open Source Network Backup Solution

Been a little while since I've blogged. I mainly blame this on World of Warcraft which I'm still playing quite a bit on Linux.

I've been looking at how I do backups at home again. I've written a script (in perl) that performs my backups, but it's been having a few problems. First of I worte it to backup my how server to my Netgear NAS. It did this using rsync to a NFS exported filesystem on the NAS. It turned out that the NAS crashes when about half way though a full backup! For some reason the NFS is pretty flakly on my Netgear ReadyNAS (which is a sparc CPU btw!).

The NAS also supported ssh and rsync protocols, so I stopped using NFS and started to transfer things over SSH. This however showed up another problem. It seems that the rsync parameter --list-dest does not work over SSH. This parameter is used to perform the incremental backups and only copy the stuff that has changed since the last time. To perform a full backup takes about 3 days currently (100Mbit network), so this is a no go. The backups need to be incremental.

I've started to think about writing my own backup application, but this time making a client/server type app that does not use rsync. Instead would have it's own storage daemon running on the NAS. At this point I started to look around at other free applications and discovered Bacula. This is what I've using to perform backups now.

This is a very nice application that consists of 3 main parts. Their is a storage daemon, that sits on my NAS. A Director which is a server that controls everything and a file daemon that also sits on my server. The file daemon is the client that is responsible for pulling files when the Director requests them. The director then stores them in the storage daemon. The good thing about this is I can run a file daemon on all the machines on my network and just have a single director on the server.

It was easy to install on my OpenSuSE machines, version 5 was available as packages and I used zypper to install them. Getting the storage deamon onto the NAS was harder. Their are packages, but they are a older version that is not fully compatible. I found I could perform backups, but not restore files. So I grabbed the latest sources and cross compiled it for the NAS which runs a SPARC architecture :-) If your familiar with cross compiling, then this is not to tricky. I need to some extra libs (sqlite3, zlib...) and then build the storage daemon static. After this it worked like a charm.

Bacula is a very command line based application, it's controlled from configuration files and a console. Once I got these all working I manged to setup nightly incremental backups. The acuall backups appear to be a lot faster than my previous solution. Their are some GUI consoles, but this are basicly not much more that a place to type commands. So in my view still a command line. I bealive their is also a web client, but I've not got round to installing that. Will be giving it ago soon.

If I don't find a good graphical client, then I might think about creating one. Main reason for this is we have a number of laptops in my family (windows and Linux) and I'd like these to have a good UI for doing backups.

No comments: