Setup guide for Backup and Migrate
The Backup and Migrate module simplifies the task of backing up and restoring Drupal databases or copying databases from one Drupal site to another. It supports gzip, bzip and zip compression as well as automatic scheduled backups.
This module dumps some or all database tables to a file, which is then either instantly downloaded or saved to the server. It also restores from an uploaded or previously saved database dump. Choose which tables and data to backup. Cache data is excluded by default. It can also backup private and/or public files.
Enabling Backup and Migrate
- Navigate to Extend (or Administration > Extend)
- Select Backup and Migrate in the Other block
- Scroll to the bottom of the page and click Install
Configuring Backup and Migrate
Navigate to Configuration > Backup and Migrate (or Administration > Configuration > Development > Backup and Migrate)
Download a backup of the default (Drupal) database by clicking Backup now. For occasional manual backups no further information is required.
Always download a backup prior to updating or installing modules.
Backup to Server
Backup and Migrate uses the default Drupal private directory to store backups on the server. If you haven't set up the private directory yet, here's how:
- Create a directory - Create a directory, writable by the server, outside the Drupal installation, and not accessible over the web.
- Example 1: If Drupal is installed in
/root/sitename/public_html
or/root/username/public_html/drupal
, the private directory would be located at/root/sitename/private
or/root/username/private
. - Example 2: If Drupal is installed in
/var/www/html/example.org/web
, the private directory would be located at/var/www/html/example.org/private
. - Note: Do not put your private files directory in
/sites/default/files
or it won't be private.
- Example 1: If Drupal is installed in
- Update the settings file - In the Drupal settings file, update the file_private_path variable to include the absolute path to the directory created in step 1.
- Example 1: If the private directory is located at
/root/sitename/private
, add$settings['file_private_path'] = '/root/sitename/private';
to the settings.php file. - Example 2: If the private directory is located at
/var/www/html/example.org/private
, add$settings['file_private_path'] = '/var/www/html/example.org/private';
to the settings.php file. - Note: You can also put these changes in the settings.local.php file, if the settings.php file is changed to allow loading the settings.local.php file.
- Example 1: If the private directory is located at
- Clear Drupal's caches - Navigate to Configuration > Performance (or Administration > Configuration > Development > Performance) and click Clear all caches so the file streams are updated.
- Check the settings - Navigate to Configuration > File system (or Administration > Configuration > Media > File system to confirm that the settings are correct.
- Set up Backup and Migrate - Navigate to Configuration > Development > Backup and Migrate > Settings > Destinations. Click Edit to edit the Private Files Directory destination. Update the Directory Path with one of the following options:
- Use
private://backup_migrate
(the most common option when using the private file system) and click Save. This option will keep your backup files together in a backup_migrate subdirectory and separate from files created by other modules that may also use Drupal's private file system. - OR
- Use the full path to your backup directory such as
/root/sitename/private/backup
and click Save. This option will save your backup files to the directory you specify.
- Use
Scheduled Backups
Enable (and edit the frequency) for the default Daily Schedule, or add your own schedule. Each cron run, enabled schedules are checked.
Restoring from Backups
Check with an experienced admin before attempting to restore from backups.
Settings Profile
You can define Settings Profile to make quick backups with configurations predefined:
- Go to Administration > Configuration > Development > Backup and Migrate -> Settings
- Create a Settings Profile with the configurations you want
- In quick backup page (Administration > Configuration > Development > Backup and Migrate) you can see the option Settings Profile defined.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion