Data loss is the worst nightmare of every website owner. Imagine working on your site day and night, plugging away at creating engaging content, just to find out one day that all your data is irrevocably lost. All the years of hard work and efforts have sunk into oblivion and you have to start all over again.
Sounds terrible, doesn't it?
But don't worry, data loss can be avoided with regular backups.
By creating a backup file, you will be able to restore your entire site in case of emergency.
As a company specializing in Drupal migration services and Drupal development, AnyforSoft is here to discuss the backup process. In this step-by-step guide, you will learn how to backup a Drupal site and then restore it in a few clicks.
If you've never done this before, don't skip this article—it might save you from permanent data loss.
So without further ado, let's get started.
What Is Backup and Why Do You Need It?
Backup is the process of creating a copy of the data on your system (or external storage) that you can use for recovery in case your original data is lost or corrupted.
To prevent your data from being lost, you have to copy it to safe storage. It can be a hard drive of your PC, a remote server of your provider, or a cloud-based file exchange service. Even if your website's files end up being corrupted, you will be able to restore them to their previous condition provided that you conduct manual or automated backups.
Doing regular backups is critical because your website data can be lost in multiple ways and at any time. It happens due to:
- Server errors. Some server errors may erase the data on your website.
- Update issues. Upgrading Drupal to a newer version or migrating your site to another CMS might cause data loss, especially if you do it wrong.
- Hacking. Hackers may corrupt or steal your website's data. Moreover, bad actors can use it intentionally for material gain. Even the most secure antivirus or firewall cannot protect your website from this threat.
- The human factor. We shouldn't exclude the human factor: you or your site administrators may accidentally delete important files from your website. Restoring them will be impossible if you haven't backed up your site's file system.
If you do not protect your data, your files may eventually become corrupted or lost, and there will be no way for you to restore them. There are many ways and methods you can apply to the creation of a quick backup. Nevertheless, all of them have a specific purpose. They have to protect your website and its data in case of an emergency. Thus, we decided to give you some helpful pointers on how to use Drupal because our company has a lot of experience with it.
How Often To Make Backups
Website owners usually make not one but multiple backups periodically for an extended duration of time. Sometimes, problems with a site can appear later, so you cannot fix your current issue using old backups you created a long time ago. A virus can stealthily enter your system and remain there for days or weeks without being noticed.
Unfortunately, it is immensely challenging to get rid of the majority of them. Thus, the most practical solution would be to delete the affected files and restore them from a backup source.
So how frequently do you have to back up your entire site, and how many copies of it do you have to make? It depends on how often you introduce any modifications to your website. If you have to work with a significant amount of data that gets updated regularly, it is best to save your backups more often. In some cases, you can even make a backup Drupal site.
To ensure the safety of your website, you can use one of the following backup organization plans:
- Arranging daily scheduled backups.
- Saving day-to-day backups during the month.
- Creating weekly backups during the quarter of the year.
- Making monthly backups of your Drupal site during the year.
We strongly advise you to create a backup of your website before each CMS, database, or plugin update. It would be ideal to have every backup that you have made during the year at your disposal. In our experience, for most websites, you have to create at least one or two backups per month to have twelve or twenty-five of them overall.
Drupal Backup and Migrate: Step-by-Step Process
A free Drupal Backup and Migrate module will allow you to backup or restore databases and files from your website with ease.
The installation of this module is simple:
- Download the backup and migrate Drupal module from drupal.org.
- Install and connect it in the “Modules” directory.
How to backup a Drupal database in its current state?
On a module configuration page admin/config/system/backup_migrate, you can select the files that you want to archive and where to save them.
To continue the process, you have to do the following steps:
- Add and save a new profile on a dedicated tab. In its Settings tab, there are only two options that you need to focus on: state the name and timestamp for your backup file and the way it is going to be compressed. Choose Zip as a compression format.
- Go to the “Backup” tab. Clicking on “Backup now” will save a copy of your site's database on your PC. Alternatively, clicking on “Manual Backups Directory” will save it in sites/default/files/backup_migrate/manual. You can change the default path according to your exact specifications.
- Click “Start backup now” and save the file on your PC.
How to configure an automatic database backup and forward it to your email address?
Since it is an extremely easy task to accomplish, this short guide will tell you everything you need to know.
To configure an automatic scheduled backup with its forwarding to a designated email address, you have to:
- Open the “Destinations” tab and click on “Add a destination”.
- Select “Email” to attach an archive to a letter that will be sent to a designated email address. Here you need to choose and save a designation’s name and set your preferred email address.
- Go to the “Schedule” tab and click on “Add a schedule”.
- Here you need to fill in all forms without exception. You need to state a task’s name, select profile settings as well as backup frequency, and where it will be saved. All you need to do after that is to save your schedule.
Congratulations! The periodical backup will now be automatic, and all files will be sent to a designated email address. It concludes our guide on how to use the Backup and Migrate module.
How to make a backup file?
The backup itself is made by a Backup and Migrate Files module. However, it is worth mentioning that this process is more convenient to be done manually.
Thus it is vital to know what files and folders you have to focus on:
- Catalog /sites ─ is a key folder in Drupal, containing a file with your settings, theme, and installed modules. It must be frequently saved to ensure that all your user profile settings can be restored no matter the circumstances.
- Both .htaccess and robot.txt files are vital for the recovery of your website. Thus, it is necessary to have their backups saved from the moment you have created your site. Ideally, you have to save these files every time you will implement any changes whatsoever.
How to use a backup?
To recover your databases from a backup, go to the Restore tab, then click on “Advanced settings.” All you need to do after that is to tick the “Take site offline” option and click “Restore now.”
If your Drupal site is working, it is also possible to restore any other files that you may need. You can select any backup files you may have that were created several days earlier. Pick an archive that contains all files you want to restore and click “Recovery.” However, you need to create a backup of the current state of your database first.
If your site does not work, then you have to do the following:
- Load a database of your website from an archive made by the Backup and Migrate module.
- Transfer all Drupal files onto your server. You can use a free FTP client called FileZilla.
- Load .htaccess, robot.txt, and /sites folder into a root catalog. If your database's location has changed, you need to edit settings.php in /sites/default catalog.
Best backup practices
General guidelines for creating and using backup:
- Save your backups before every Drupal update, without exception. Your database can become damaged in the process, or you can accidentally delete an /sites directory. You will not be able to run your website after that, so be sure to get it covered.
- Make a backup each time you have to update, transfer, or clean your database. Also, make sure to get it saved before every single optimization or even its entire replacement.
- Use an automatic backup of your database and frequently save a copy of /sites folder on your PC. Make frequent daily, weekly, or monthly backups or create them whenever you deem necessary.
- Date every single backup you make and store it on a different web server. Remember that if don't have at least three backup sources for your important data, then it is not well-protected at all.
- Learn more about the policies of your internet provider or web hosting. Many of them have a dedicated backup plan that can be used every 24 hours. If they do not have one, you need to make it yourself.
- Assess the cyclicality of your backup by defining the amount of data you can afford to lose in case of an emergency. Document and thoroughly test both your backup and recovery procedures.
This is everything that you need to know about how to back up a website using Drupal and restore it from a backup source. We hope that our article and the recommendations listed in it will help you create a reliable backup system. By following these simple guidelines, you will avoid any issues that may happen with your website. If you have any doubts, contact our AnyforSoft support representatives at any time. We know everything about Drupal, its backup and restore, so we will help you deal with any problem you may have with your site quickly and easily!