How to Backup Your WordPress Website (and Multisite) Using Snapshot
Your WordPress database contains every post, every image, and every setting that you’ve configured on your website, which means if your database is corrupted or erased, you could lose everything. And if you believe Murphy’s Law, anything that can go wrong, will go wrong.Since Snapshot was launched we’ve added sooo much new stuff! Head over to the project page to check out all the new features.
It only takes a few minutes to make a backup of your site with our Snapshot Pro plugin. Snapshot Pro will backup your content and let you restore it with a click. Think of it as a time machine for WordPress.
With a proper backup of your database and files you can quickly restore things back to normal if disaster strikes.
If you don’t back up your site, what’s your excuse? Maybe you simply don’t know what backups are, or you’re just too lazy to backup your site. Or maybe you assume your web hosting company backs up your site for you? There’s not point assuming your host will look out for you, especially if you have cheap shared hosting. If your host does do backups, they might not be scheduled regularly and you most likely won’t be notified if backups fail. If you do rely on them to save your bacon you might have to wait around for support, wasting valuable time.
It’s important to ask yourself, would you be screwed if you lost all the work you’ve put into building your site? Would your client be happy if their site broke? Probably not.
Servers crash, developers make mistakes and sites get hacked.
All it takes is 10 minutes to back up your site. In this article, I’ll walk you through how to backup your site with Snapshot Pro.
Install and Activate
If you run a Multisite network, Snapshot Pro will activate across your entire network. The plugin will also offer the option to backup everything or pick and choose which sites and database tables you would like to copy.
Configure the Settings
Let’s go through the settings for Snapshot Pro. Go to Snapshots > Settings in the admin dashboard.
The settings here apply to every snapshot – or backup – you create, although individual settings can be configured later on. Also, each section is treated as being separate so don’t forget to click the Save Settings button after every change you make.
The default settings are great for most users, but let’s break down each section so you can set the best fit for your specific needs.
The Backup Folder field is the name of the folder where your snapshots will be stored under wp-content > uploads. The best name is one that is easily identifiable by you (or your client if you allow them to manage their backups).
The Segment Size refers to the number of rows in a database table that are copied at one time during the course of a backup. For example, if you choose a segment size of 5000, it means that table rows will be copied in batches of 5000 to reduce the chances of your server timing out and aborting the backup.
Whether you have a smaller site or larger one with about 80,000 or more rows per table, it’s recommended you enter a segment size larger than 1000 rather than less.
Skipping down to Memory Limit, this is where you can define how much memory Snapshot Pro uses to perform a backup or restore. You can either choose a smaller value than the default to restrict the memory usage or increase the number as desired.
Keep in mind that Snapshot Pro does need more memory than what you may have specified in your wp-config.php file because you aren’t just loading typical pages of your site, but creating comprehensive backups and restorations. Unless you really need to restrict the memory Snapshot uses, it works best at the default value of 256 MB or otherwise by increasing this amount.
To set the memory limit, choose a number, then follow it with an “M” for megabytes or “G” for gigabytes without a space in between. For example, you can set a limit to
2G or another amount of your choice.
You can also select a number that’s higher than the value defined in your wp-config.php file. If you don’t change this option, your php.ini and wp-config.php files are compared, and the largest specified amount is used.
If you would like to exclude certain files or folders from being backed up, such as a theme you don’t use or a file you added for testing purposes, but don’t need anymore, you can enter them into the Global Exclusions field. The files or folders you enter here will be skipped over for each backup you make.
If you prefer to exclude files or folders on a case-by-case basis, you can do this later when you create a backup.
You can add a shortened version of the file path if you would like, but be sure to at least include the parent folder that houses the file you would like to exclude. For example, to exclude a file called testing.php in wp-content > uploads > 2015 > 05 folder, you could enter
/wp-content/uploads/2015/05/testing.php or just
The Error Reporting section determines whether different kinds of errors are simply logged or if backups are halted if they occur. There are three types of errors to consider here: Notices, warnings and fatal run-time errors.
Notices are simply messages that let you know when Snapshot has found something that looks like an error, but could also be completely normal for some plugins and scripts. Warnings are errors that exist, but don’t break your site, while fatal errors can break your site or otherwise cause Snapshot and other parts of your site to stop running altogether.
By default, only fatal errors are set to stop a backup, but you can choose to stop backups for warnings and notices as well if you wish.
The final section, Compression Library, is where you can choose your backups to compress with ZipArchive or PclZip. While ZipArchive is generally faster, it may not be included with your server’s version of PHP. It is included in most cases, but if you’re not sure, use PclZip since it is included in your WordPress install.
It may be of importance to you to note that PclZip uses memory while ZipArchive uses files to use as temporary storage when compressing large files. This means that PclZip will use more memory to backup and restore large files, but won’t use more server space. ZipArchive has the opposite effect.
Choose External Backup Destinations
By default, your backups will save to your server only. This is fine, but isn’t always enough. If you or your hosting provider accidentally wipes your server clean while migrating your site, for example, you not only won’t be able to restore your site, you’ll lose your entire site, permanently.
This may sound like an unlikely situation, but it can happen, as we shared in our recent article, Backup Plugins Aren’t about Backing up, They’re about Restoring.
If you would rather be prepared for any number of terrible situations, it’s essential to backup your site to other locations as well as to your server. You can do this in a few easy steps with Snapshot Pro.
Start by going to Snapshots > Destinations in your admin dashboard. You’ll have five places to choose from: Amazon S3, Dropbox, FTP/sFTP, Google Drive and GreenQloud Storage.
Click the Add New button beside the name of the destination you would like to use to set it up.
The specific setup instructions will be listed for you on the next page. Don’t forget to click Save Destination at the bottom of the page when you’re done filling out the required information.
You’ll need to choose a Destination Name which is simply a custom name to help you personally identify the accounts you have connected since you can add multiple accounts under each external destination.
If you would like to use Amazon S3, you need to set the proper permissions for the account you are using under the user policy. Be sure to select Amazon S3 Full Access from the permissions list to avoid errors.
When you’re accessing the developer’s console to set up Google Drive, make sure the information under API’s & Auth > Consent Screen is entered correctly. If you do not enter an email address and product name it will result in an error.
Create and Schedule Your Backup
Once you have set up your desired external destinations, you’re all set to create your first backup. You’ll also be able to schedule regular backups so they run automatically without any extra configuration on your part.
Go to Snapshots > Add New in the admin dashboard. Start by naming your snapshot.
The Name and Notes fields are optional, but they can help you identify your snapshots later on.
Next, select the files you want to include in your snapshot. You have three options:
- Do not include files
- Include common files – For example, active themes and plugins
- Include selected files – You can choose the specific kinds of files to backup
After you have selected the files you wish to include, you can choose to archive the snapshot as a standard zip file or as a mirror archive. This last option is only available for Dropbox and we recommend sticking with the regular archive option since there is no restore option for mirror backups.
You can also type in the files or folders you wish to exclude from this snapshot, but not others you create – unless you decide to include them there or globally on the Settings page.
Next, it’s time to decide which database tables to include in your snapshot. Just like the previous section, you have three options:
- Do not include tables
- Include all current and new blog tables
- Include your selection of tables – if you select this option, a list of tables will appear that you can select to include by clicking the checkboxes.
Once you’ve made your selection, you can move on to selecting the frequency of your backups. You can choose the default Run Immediate option which will create one snapshot as soon as you save your settings. You can also create scheduled backups by selecting the frequency in the drop down box labeled Backup Interval.
If you choose to schedule backups, another option will appear to choose the time you want your backups to occur. Usually, scheduling backups once a week is enough for most users, especially if your site doesn’t change much on a daily basis.
It may be important to note that Snapshot Pro uses WordPress Cron to schedule regular backups. This means that snapshots may not be taken at the exact time you choose as explained in this section of the Snapshot Pro setup page:
The Snapshot scheduling process uses the WordPress Cron (WPCron) system. This is the same process used to run daily checks for updates to core, plugins and themes. It should be understood this WPCron process is not precise. If you schedule a Snapshot for a specific minute of the hour WPCron may not execute at exactly that time. WPCron relies on regular front-end traffic to your website to kickoff the processing.
Once you have decided on the timing of your snapshots, you can choose how many snapshots you would like to keep stored by typing in a number in the field labeled Maximum number of local archives. Once you have saved the number of snapshots you indicated, the oldest one will be removed as the newest snapshot is saved.
The final step in creating your snapshot is to choose where you would like to store your backups.
Click on the drop down box labeled Backup Destination to choose from all the external storage places you previously set up. If you would like to send snapshots to multiple locations you can set up a new snapshot for each destination.
Optionally, you can also supplement or override the default directory your snapshot will be sent to by entering it in the final field called Directory.
Once you’re happy with all the selections you have made, click the Create Snapshot button at the bottom of the page. If you chose for your snapshot to run immediately, your site will be backed up right away. If you chose a specific time, your backup will run then.
Depending on the size of your site, it may take a while for your snapshot to complete. There’s no need to worry if your snapshot takes more than a few minutes to finish.
If you need to cancel the snapshot as it’s being created, just click the Abort button beside each item as it begins to be processed.
If you click the button only once, the corresponding table will be excluded and the backup will resume to the next item on the list.
Viewing Completed Snapshots
To see all the snapshots you currently have, go to Snapshots > All Snapshots in the admin dashboard.
Hovering over the title of a snapshot will reveal additional options including edit, run now, restore and delete.
This is where you can see snapshot’s one-click restore in action. Clicking run now will start your backup at the time you previously selected.
You also have the option to import a snapshot that isn’t already listed in the All Snapshots page. To do this, go to Snapshots > Import and enter the publicly accessible URL or local path of your snapshot and click the Scan / Import Snapshots button.
There are additional tips on the Import page to guide you through this process in case you get stuck.
You’re now all set to start creating and saving snapshots of your own. Your site should be a little safer and if you find you do need to recover your site at some point, it will be a lot faster.
For more information on securing your site before disaster strikes, check out some of our other articles: Creating A Disaster Recovery Plan For Your WordPress Site, WordPress Security: Tried and True Tips to Secure WordPress and WordPress Security Essentials: Obscurity Tactics and Backups.
Have you ever had to restore your site after an attack? What have you learned in the process? Feel free to share your experience and tips with other members in the comments below.Tags: