Network Engineer

Welcome to my little blog. I am mostly techie over here, blogging about networking and system administration topics, but there will also be some Travel Reports from time to time…

My Backup Strategy

January 3, 2009Christian Kildau0 Comments

Now that a new year is here I really need to finish some points of my To-Do list! Here we go…
As I said few weeks ago, maybe a little bit delayed, here comes how I backup all my stuff. This post is not a how-to. It’s just a configuration example. If you want a howto use this link.

Some theory
I have a central fileserver, some application servers (Web, Mail, MySQL) and a few workstations (Mac, Win, Linux).
All I want is a simple way to backup databases, mails, configs and of course documents on my fileserver to an external harddisk. But there is no do-it-all tool.
There are many small and some bigger tools to do what I want. Some of them look unmaintained, some of them are hard to setup and some… ah let’s say I didn’t like them
The two lists at (list1, list2) were very helpful to me.

For me it all came down to two tools: Backuppc and Rsnapshot.
Backuppc is a big tool. It’s designed for large networks with serveral Workstations. Besides Rsync over SSH it does support backing up Windows machines natively over SMB and has a (in my eyes pretty ugly and unclear) WebInterface to manage your backup jobs… I haven’t managed to setup a single backup job in 30 minutes through the Webinterface, but I didn’t RTFM though. Backuppc has some nice features that Rsnapshot is lacking: compressing, nice restore options, reminders…
Rsnapshot is more closely to the “one job one tool” philospohy of UNIX. It uses Rsync over SSH. You can also use Rsnapshot to backup your Windows machines, but you’ll have to install cwRsync on every Windows machine. Setup is (in my eyes) very easy… just modify the well documented rsnapshot.conf to your needs and let rsnapshot run via cron.

My Backup strategy
I choose rsnapshot to backup at least my documents and configs (time will show how well it performs for maildir) and AutoMySQLBackup for (guess what?) MySQL.
Since configuration is that easy I’ll  just show my snippets from rsnapshot.conf

Configs, Documents & Stuff on the machine rsnapshot runs on:

backup /home/ fry/
backup /etc/ fry/
backup /var/www/ fry/
backup /srv/data/photos/ fry/
backup /srv/data/music/ fry/
backup /srv/data/documents/ fry/

The Webserver (via SSH):

backup root@leela:/etc/ fry/
backup root@leela:/home/ fry/
backup root@leela:/srv/data fry/

I think you got the idea. Just read the comments if you didn’t.
Finally my full rsnapshot.conf:

snapshot_root /srv/backup/hosts/
no_create_root 1
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
interval daily 7
interval weekly 4
interval monthly 3
verbose 2
loglevel 3
logfile /var/log/rsnapshot
lockfile /var/run/

backup /home/ fry/
backup /etc/ fry/
backup /var/www/ fry/
backup /srv/data/photos/ fry/
backup /srv/data/music/ fry/
backup /srv/data/documents/ fry/

backup root@bender:/etc/ bender/

# LEELA (Web)
backup root@leela:/etc/ leela/
backup root@leela:/home/ leela/
backup root@leela:/var/www/ leela/

# AMY (Mail)
backup root@amy:/etc/ amy/
backup root@amy:/home/ amy/
backup root@amy:/var/bogofilter/ amy/
backup root@amy:/var/mail/ amy/

# ZOIDBERG (Relay1)
backup root@zoidberg:/etc/ zoidberg/
backup root@zoidberg:/home/ zoidberg/

backup root@farnsworth:/etc/ farnsworth/
backup root@farnsworth:/home/ farnsworth/

That said about documents and mails backup. Please also read the comments in rsnapshot.conf, the official HowTo and the manual.
I already wrote a post about MySQL backup. It’s configuration is as easy as:

DBHOST=yourmysqlserver's hostname

I backup to a 500Gb WesternDigital HDD in an external case which I mount on demand. Since the case has it’s own PSU that gives me at least a little security from power peaks (a dying PSU already killed my motherboard and harddisk a few years ago) or scripts running amok or accidently deletion…

Now that you know how I backup, it’s time to read a bit about restoring. Fortunately with rsnapshot it’s as easy as copying the relevant files/directories from the backup to it’s origin through commandline (use cp or maybe rsync), midnight commander or whatever you want…

Leave a Reply

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.