Skip to content

Server backups: everything else you should take care of

Databases and code are the obvious parts of any system to backup (and if you don’t have any backups, take a backup right this very second!)

But what else is it useful to have backups of, even if they’re on a one-off basis?

Here’s a quick list of what I’m backing up today.

1. Configuration files

Whether you need a reference to set up a new server, or you’re having to do a full recovery, being able to work from configuration files that are known to have worked in production is a huge bonus. For me, this means backing up the following:

  • Your web application configuration files should really already be in source control, but if not, back them up!
  • nGinx config directory (or whichever webserver you use, Apache, Lighthttpd or otherwise)
  • MySQL my.cnf
  • PHP php.ini and associated php.d config directory
  • PHP-FPM php-fpm.conf and php-fpm.d config directory
  • Monit
  • Munin
  • Ejabberd
  • ActiveMQ Apollo

2. SSL certificates and keys

Depending on where you keep your SSL certificates, this might be included in your web server configuration backup, or separately. Sit down and think for a few moments, though; is there some other piece of software which relies on SSL certificates in a non-standard location? In my case, I had set up Ejabberd’s SSL fun in a different directory.

3. Startup scripts

Knowing what you had running on your system is vital, and taking appropriate backups can be a real lifesaver if configuration changes between versions.

  • Take a log of chkconfig‘s output.
  • /etc/init.d – make sure you use tar’s -h flag so that any symlinks get resolved and the files included

4. Hard drive saviours

In a moment of true brilliance, I once managed to fat-finger a command to copy across the partition table from one disk to another, leaving myself in a sticky situation. Don’t let this happen to you.

  • Take a log of sfdisk -l 
  • Backup your RAID configuration

5. Nice-to-haves

List all of your web root’s files and subdirectories, along with their permissions:

  • ls -dl `find /var/www -type d` > web_root_listings.log (replace /var/www with your own webroot)

One time backup of /var/log – all kinds of useful information can be buried away here.

Just. Do. It.

If you don’t have a backup – any backup! – you’re going to be kicking yourself when something goes wrong. Take twenty minutes today, even if it’s in your free time: you’ll be saving yourself a lot of work when the inevitable happens, and even make yourself look awesome for having backups already in place.

That’s my list for today. What have I missed? And do you have any tips for improving on this, whether through automation or otherwise?

Written by Tom

Are you looking for web development or just someone who will work with your business needs and not against them? Get in touch with me here, or take a look at my business website. I’m confident I can help you.

Published inTips

One Comment

  1. Robin Robin

    Also a good idea to backup crontabs. And the installed packages list from your package manager – on debian based systems: dpkg --get-selections

    I’ve found backup4l to be a useful lightweight incremental backup system. With a pre-backup hook to dump databases and a post-backup hook to rsync the backup files to a remote server.

Leave a Reply

Your email address will not be published. Required fields are marked *