Occasionally, even experienced Drupal administrators will make a mistake and need to revert their latest database changes. Nobody is that good at Drupal and in some cases, it’s not anyone’s fault really, but things go wrong. It is always best to backup your Drupal website database before and after making any changes to your Drupal site like Drupal core updates or Drupal module updates. It is also wise to make weekly or daily database backups if your site receives or adds content often. Having a recent Drupal database backup will save you time and will reduce your stress level if you need to rebuild or restore your Drupal website for any reason.

Believe me, it happens to the best of us. Don’t think you are the exception to this rule for any reason. You may follow all the rules and all of Drupal’s best practices, but you still may end up blowing up your site at some point. This may scare some of you off, but there is hope. The Backup and Migrate module makes it easy for any Drupal administrator, experienced or not, to backup and restore their Drupal database within their Drupal website. Out of the box, the Backup and Migrate module is a great addition to any Drupal administrator’s toolbox. It has some fairly good default settings, but has some great configuration options that really make it the best Drupal module for backup and restoration of Drupal databases.

The Backup and Migrate module allows you to make manual backups on the fly or you can also schedule MySQL backups for your Drupal site and send them via email, ftp, or save them locally to another location on your server. Setting up scheduled backups is probably the best method to make sure your sure is backed up regularly, and you won’t forget to back the site up. Each schedule is independent, so you can setup multiple types of scheduled backups for your Drupal website. I have setup daily, weekly, and monthly backups for different types of backup scenarios. I would recommend at least a monthly backup so that you don’t lose much data from your site if you need to restore.

Aside from backing up your Drupal database, you will also want to have a fresh copy of your files directory. Luckily, there is now a Backup and Migrate Files module, which will allow you to backup your files directory similar to how you backup your site with the Backup and Migrate module. The module is still in development, but is a promising new module that will continue to ease the administration of backing up and restoring files directories within Drupal websites.

Backup and Migrate doesn’t solve every problem though for backing up and restoring a full Drupal website. You also need the Drupal core files, modules, themes, libraries, and any other files that you need for your Drupal installation to run properly. This should be handled by a version control system such as Git, Subversion(SVN), or Mercurial. Git is really the best choice for version control when it comes to Drupal at this point, as the Drupal.org website has updated from CVS, an old deprecated version control system, to Git. Git will make it easy to download and possibly contribute code within the Drupal repository, as well as within your own projects. Sites such as Github and Unfuddle provide free Git repository hosting if you are looking to work on projects outside of Drupal.org. Keeping your code in version control will save you a ton of time and effort if you need to revert your code for any reason. It will also allow you to collaborate with multiple people on a single project without stepping on each others’ toes and overwriting someone’s changes.

This post was more of a wake up call rather than a how to on backing up your Drupal website. We were more interested in getting the word out there that it’s not that hard to backup your Drupal website’s files directory, database, and installation files. It’s better to know now then to find out next week when it’s too late. There is enough documentation out there to get you going on the right direction for now. Stay tuned for a follow up post on how to use the Backup and Migrate module to backup your Drupal database and then restore your database if needed.