Accidents happen, one wrong click and you might have deleted important parts of your community. This probably is among the biggest nightmares of every administrator out there. While the accident cannot be prevented, it can be undone by having a proper and recent backup of your community. This tutorial will explain how to create a proper backup, depending on the tools you have available.
Having backups is great, but ones dating back to 6 months ago or even completely broken won't be any helpful. In every case listed below it is important that you:
- Regularly check that new backups are created.
Creating a cronjob is not sufficient, you should check the logs that the cronjob really runs without error messages.
- Regularly check that your backups contain all the data you need to restore your community.
A sanity check could be: The size of the backup is at least X megabytes. For example: A database dump with 10 kilobytes in size almost certainly is broken.
- Make yourself familiar with the process of restoring a backup.
Check whether you are able to restore a backups after every modification of your backup technique! This also ensures that the backup contains the data you need.
- Backup both the database, as well as the files and both at the same time.
Your file backup is useless without the corresponding database backup. A database backup is next to useless without the corresponding file backup. While you are able to import the database into a fresh forum you'll definitely lose data (e.g. data from plugins).
- As always: Think before you do something. While this manual aims to be correct and mentions most of the pitfalls, the exact circumstances may break some assumptions we made. If something does not work like expected: Ask. Ask. Ask. Remember to regularly check your backup (one cannot mention this often enough). We cannot take responsibility if something goes wrong.
When to Take a Backup / How Often Should I Take a Backup?
We recommend taking a backup as often as possible. In any case a backup should be created at least once a week for smaller communities and once a day for larger ones, you'll lose to much data otherwise (these regular backups protect against accidents and mistakes outside your control). Before making major modifications (this includes every installation or update of plugins) to your community a backup should be created as well to not unnecessarily lose new data (this removes the gap between the last regular backup and the planned and intended modification).
Restoring a Backup
- Make sure that no one, not even you, accesses your community during that time, otherwise further data might be destroyed.
Add a .htaccess password protection, maintenance mode is not sufficient.
- Take your time during the restore and double check everything.
An incomplete or incorrect restore might have destroyed even more information without you noticing it.
- Keep in mind that restoring a backup might take a long time.
Ensuring a stable Internet connection is important to not interrupt the restore. Informing your users about the progress during that time to not leave them wondering might make sense as well.
- Always restore matching backups of the files and database, even if only one of these is broken.
This one goes hand in hand with the next-to-last bullet point of the “General Information”.
Taking a Backup
Whenever we are talking about the file system we mean everything that is inside the folder of your community. Do not leave out folders you deem not important! The folder you need to backup will look something like this: