Backing Up

Reviewing back up regime here so thought I would talk about it. Mostly this is done with the aim of making restoring sites easier after catastrophe. Sites are on a mixture of dedicated machines and shared hosting.
So you think about the things you would need if some thing ( think hard drive ) went bang poof in a cloud of smoke.

  • The database
  • Customer edited or uploaded files via a Content Management System CMS or LMS
  • Logs

So for example on a WordPress site might mysqldump the database and zip up the wp-content/uploads directory. Because I have the php files and theme files on a test server somewhere else like a laptop.


Once those backups are made they need usually to be kept of the machine, that you made them from otherwise your backups disappear at the same time as the original.
Its worth trying to use them I do this on my local copy of a site this reassures that the backups are working. It also makes sure the local site that I’m testing on has a reasonably representative and realistic set of data. Which is helpful as sites grow and things that were performing fine with Z amount of data might struggle with 10xZ.


Because backing things is quite dull it helps a lot if you can automate it. A backup job that fires every Y days is a great labour saver. Computers unlike people love this sort of thing. If you can automate moving the files away from the originating server its great too. Dropbox and Amazon S3 for example have code libraries that you can use as a basis for a file moving script.


This is a bit of a how long is a piece of string question but you have to take into account how important something is and how frequently it changes. Some things I backup every night others only monthly. Some the worst that would happen is someone might lose a blog post other times they are taking orders and keeping records is more important.

How long to keep it

Not so sure about this I’ve got copies of some sets of files going back years. That is a bit pointless but perhaps that is right for you. Sometimes if the data over a certain age doesn’t change then you may only need to backup the newer files rather than keep backing up the same possibly large files month after month.

This is all aside from any backups the hosting company may keep and larger system wide machine images.

Making it part of development process

I do this for most of the sites I maintain and I’ve made writing backup scripts one of the things I do when I’m putting together a site which helps me remember it.

Beep Beep vehicle reversing