Drupal is one of the big three CMS. Together with WordPress and Joomla offers a complete solution to build a working website in a few hours with minimum knowledge about PHP, HTML or CSS. If you already run a few Drupal powered websites, you should think about its backups. Beware of hackers, server failures or your own errors.
There are many ways how to make a Drupal database and filesystem backup. I will show you a few tips how to do this backup in relatively user friendly way. If you run some really big website you should use your webhoster backup solutions (like cPanel backup in Hostgator) or do the backup manually using the mysql and gzip commands.
1. Install the DB Maintenance module
Before you will start any database backup in your Drupal installation, I highly recommend to optimize and repair your database tables. This will help to speed up your website and, what’s maybe more important, the database backup will be smaller. Install the DB Maintenance module.
After the installation go to the Site Configuration, DB Maintenance. Enable the Attempt REPAIR of table if OPTIMIZE is problematic option and select all tables in your database. Don’t forget to go here after a new module installation and add the new tables to optimization process.
Select the optimization interval (Weekly is enough) and take a look below the tables list. There are some options about database and files backup. Select the backup interval for database and files. Check the paths, provide your e-mail address for notification and save the settings.
Very important: To check how the Drupal backup with this module works, set up the backup for each cron run and after saving the configuration, run the cron.php process. After that, check the output folder for backup. If you don’t see file called like 20090220_10-46-13_maxiorel_maxiorelcom_db.sql you have to check the path settings. The common problem is wrong backup folder specified. For example, Hostgator users should use the server path. Since you don’t have access to /tmp folder you have to use /home/yourname/tmp folder.
Security info: Do not save the backup to public folder visible from web browser!
2. Backup Files module
This is another backup solution, but it works only with your Drupal files. Since you have backup them to your computer very easily via FTP, I don’t think that this module will be very useful for you. What’s very important, this module doesn’t backup your Drupal’s database. And without database are your files useless.
But if you can try Backup Files module, enable it and go to the Content management, Backup Files. Specify the directories you would like to backup. The files folder is default, I recommend to add your own themes, so the sites/all/themes folder and maybe the sites/all/modules too. The rest can be restored using the Drupal installation package, so you don’t have to backup it each time.
Don’t forget to set up the paths and try to Test settings using the appropriate button.
Note: There are some situation, when the DB Maintenance couldn’t be used but the Backup Files will do the backup job. More info is below.
3. Backup and Migrate
The last backup module I would like to mention is Backup and Migrate. This module is intended to users who are preparing to move their Drupal installation from one webhosting to another. Enable this module and go to the Content Management, Backup and Migrate. There are four tabs available.
Backup/Export DB – select tables you would like to exclude (I do not recommend) and tables which content you would like to exclude (I recommend accesslog and all cache_ tables). Provide the backup file name (using replacement patterns), set up the compression and click the backup Database. You backup will be created immediately.
Restore/Import DB – if you have moved to the new server, upload here your previously created backup. Remember, that this feature is useless for most of the websites, since the database backup are often bigger than maximum file size for upload.
Saved Backups – this feature will allow you to work with backups created in the past and optionally restore them. The backup files has to be in your backup directory.
Backup Schedule – only two options are available here. Provide the number of each hours the backup is created and the number of old backups to be kept.
Think about your needs
Each of the Drupal modules mentioned above is intended to another user or solution. For regular backup I highly recommend the DB Maintenance, because it could run on scheduled interval and backup the files together with databases.
Backup Files module is useful when you would like to create the backup of your files and download the directly via the web browser.
And finally, if you are going to server migrate process, you will find the Backup and Migrate module useful.
The differences between files backups in DB Maintenance and Backup Files module is in using the command to create a backup. The DB Maintenance uses the tar command and create the tar.gz files with better compression. The Backup Files module uses Archive_Tar from PEAR Package and can be run where you don’t have access to the tar command directly.
I hope that this article is useful for you and help you to decide which Drupal backup solution is right for you. If you are interested in another Drupal related articles, I recommend you my another website at www.maxiorel.com (English) or www.maxiorel.cz (video tutorials for Drupal, but here only in Czech).

















I've been looking around for a Drupal 4 database backup solution and I couldn't find any.
Backup & Migrate works only for Drupal 5+
There is another module Backup - http://drupal.org/project/backup
But it is in Drupal 4 Dev.
Not sure if it would work or not?
Has anyone tried this on Drupal 4?
It seems to be able to work on Drupal 4.7.x, but is is a DEV. I highly recommend to upgrade to Drupal 5 and then to Drupal 6 if possible.
nice article but i still not get it.
i have a working website on a server. i understand that to save the drupal files all i have to do is copy them from the public_html and to do export in my sql.
but now i want to take this backup and put it in my computer to work around and try things without harming my website thats on the server. i have xampp on my computer and when i put the drupal files in a folder (for example mywebsite) in the htdocs libery and import my database , when i go to http://localhost/mywebsite/ its not working .
can u help me with this problem?
nisan sabag
Do you have any error message from your Drupal local installation? Don't forget you have to edit and change the settings.php file with new database credentials for the local computer.
Jan,
Hi I'm new at this and researching backing up 500 mb website. I've heard that php times out and will not work on the larger sites. Your thoughs appreciated.
J
Hi, I think 500MB website should be relatively OK for PHP backup scripts. However if your server is configured with a short time and the backup script will time out, you have only one chance - backup your Drupal installation manually using tar commands via the SSH.
Very useful post. Thank you for posting!
Hi Jan,
Thanks for this great article. Will try those modules soon :)
I've been learning Drupal for a couple of month's now. And I'm working on my first Drupal website. Being a non-programmer, I love how Drupal makes it possible for me to achieve certain functions for my website :)
Just wanted to ask if it's necessary to disable modules before making a copy of the sites folder or the entire website directory for backup. I'm still working on local server, and I backup my work twice a week.
After making a copy of my database, I usually disable the modules before creating a copy of the sites folder. It's quite a task disabling and re-enabling modules, so I wanted to know if perhaps I could skip this step, if it's unnecessary.
Regards,
Cecille
Hi Cecille, I never disable modules before backing up or copying the website. It works well. So disabling is not necessary.
Finally I could backup much faster!
Thank you and all the best to you!
Cecille
Hi Jan -- Just came across your article and would like to say thanks!! I've been investigating backup options for drupal 6 (since I will be upgrading my drupal 5 installations very soon) and the info you provided will definitely help out in deciding among my (many) options...
Take care
`T
You're welcome :-)