Drupal Backup – overview of the options
“Backup! Call more backup!”
– remember the lobby shootout scene from The Matrix? Well, not surprisingly, what is true for the Matrix is also true for the primitive computers of today: you simply cannot have too much backup.
First Rule of Backup: “if data doesn’t exist in three places, it doesn’t exist at all” understates the problem: just the other week I was called to help some fine folks who turned to their backups only to see the main copy perish in a server crash, and the precious second copy dropped by a nervous sysadmin. Thankfully, there was an (accidental) third cop, which still somehow missed a few tables (we restored them from an earlier backup). Three backups turned out to be insufficient!
That is why I am a huge fan of RAID6, although even that is not the ultimate solution – I have seen hardware raid controller fail subtly, filling the drives with gibberish (and right after the main tape backup failed! – heads rolled for that one).
Second Rule of Backup: “Test it. Now see if you can actually RESTORE.”
Fortunately, Drupal is easy to backup, if only you stop to think it through.
First, read this document – there is no better introduction to Drupal backup.
You want to backup:
- Your full Drupal installation, or, failing that
- sites/all – that’s where your modules and themes are
- sites/default – contains the ever-important settings.php
- .htaccess – chances are you have modified it at some point
- any core files you patched
- Drupal file system – it contains all your images, uploaded files, and such. It is often under the files directory, but may be elsewhere: look it up by following your admin interface to admin/settings/file-system
- The database (with all your text, tags, configuration, everything).
One can accomplish all these tasks manually, but who has the time? So a bunch of nice user contributed modules come to the rescue:
- Filesystem Backup – can archive all (or only changed) of your files and email them to you in archives of configurable size (to deal with attachment size limitations). Unfortunately, the module has been effectively abandoned, so if you want easy fame – take over its maintenance!
- Import/Export API – is not for the timid. If you have enough data to justify the effort, it will allow you to create sophisticated import/export rules. The module has potential to become a universal migration/integration tool. It does lack support (at the moment of this writing), so unless you have some truly sophisticated needs, pick a more straightforward solution.
- Backup module actually stunned me with its thoughtful UI ( backend modules do tend to be somewhat less polished since they assume a more technical user). It backs up both your files and your data, and the documentation explains clearly why it cannot perform the restore process (yes, it does make sense). Be careful: the module may fail in some restrictive hosting environments (if you are paying less than $10 month you got to wonder what it costs you). Remember to confirm that your backups can be restored!
- Backup & Migrate is a database-only backup/restore module. Its focus gives it power – it is rather sophisticated:
- allows you to ignore specific tables, or data within tables
- saves backups locally, or all0ws you to download/upload them
- performs scheduled backups – this is truly an invaluable feature!
Once again: it does NOT backup your files, only the database.
Database Administration module can, among other things backup your database (not your files). It is a very powerful tool, sort of like a subset of the infamous phpMyAdmin, which is why it is taking a while to update it for Drupal 5.xx. Current development version is almost there…
The Bottom Line
If Backup module works in your environment and fits your requirements – you are the lucky winner!
For larger sites, Backup and Migrate is the way to go for database backups. You will have to concoct a simple script (suggestions, anyone?) to perform a faile backup triggered by cron.
For a totally safe, automated solution you will also need an off-site service logging in and sucking those backups to a safe destination (there is not point in a backup if it sits on the one server that’s down, is there?)
Know good backup storage? Post it here.