Skip to content

Drupal backups

  • Drupal

You will always want to backup your entire Drupal website before any updates or upgrades.

The easiest way to get a full dump of your site, use the `drush ard` command, assuming you have drush installed (  Archive-dump, ard, backs up your code, files and database into a single file.  An example command line would be:

drush ard --destination=../backup/yourwebsiteBackup-MMDDYYYY.tar

Restore a backup using the same method that the backup was performed.  In the drush example the drush command archive-restore would be used.

If you do not have access to drush, you’ll need to complete the backup in two steps.  (1) Back up the database, (2) backup the ‘sites’ directory.

Backup the database.  This is where all of your website content is located; all articles, pages, user profiles, views and so on.  The Backup and Migrate module makes quick work of database backups.

You can also use phpMyAdmin for database backups.  Most hosting companies have an online utility for database backups as well.

Backup the ‘sites’ directory.  This is will capture Drupal core files, added modules.

If you have access to the command line, use the copy command with the option –rp, recursive and preserve permissions:

cp -rp /path/to/drupal_site /path/to/backup_dir

Take note of your Drupal version number before any updates.  You could retrieve a fresh copy from  But, I really prefer to have my own backup handy.  If you’ve made even the slightest tweak to Drupal core files, having your own copy will just be one less thing to keep track of.

If you are running into resource limitations for regular backups every month, make sure you at least back up the /sites/all/modules/ directory.  The goal is to have an archive of which modules are installed.

Your uploaded images are in the directory specified under Administration > Configuration > File System.  Typically, /sites/default/files is the file system path.

For peace of mind when performing updates and upgrades, there are a few best practices to follow.

  • Make your pre-upgrade backups after you put the website in off-line mode.
  • Keep three copies of your backups in separate locations.
  • Keep additional copies of .htaccess and robots.txt separate from the Drupal core backup.
  • Document your backup procedures.
  • Restore your backups to a test environment.  Hosting companies can create roadblocks in terms of ftp or php processing time limitations.  It is better to have established workarounds before you need them.