How to Backup Your WordPress Website (and Multisite) Using Snapshot

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. Check out Snapshot

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 like 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

Grab a copy of Snapshot Pro from our available plugins list or directly to your site using the WPMU DEV Dashboard plugin.

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" page under the "Snapshots" tab is highlighted in the admin dashboard.
If the Snapshots tab doesn’t appear right away in the admin dashboard, just click the refresh button in your browser.

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 Folder Location > Backup Folder section of the Snapshot settings page. The Default folder name "snapshots" is displayed.
You don’t need to create the folder beforehand. In fact, don’t, since the folder will be created for you automatically.

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.

The default value of 1000 is set in the field for "Segment Size."
You can increase the segment size, but it’s not recommended that you choose a value lower than 1000.

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.

The "Memory Limit" field of the Snapshots > Settings page has automatically been populated with the value "256M."
It isn’t necessary to change the default value, but if you have the resources available to increase the memory limit, it’s a recommended option.

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 256M, 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.

File paths have been added to the "Global Extensions" section of the settings page. Fuller and shorter file paths have been used.
If you have multiple folders or files with the same name in different locations, be sure to specify its parent folder to avoid errors.

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 /05/testing.php.

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.

The default options are displayed in the "Error Reporting" section. Only fatal errors will stop the Snapshot plugin from working, but all error types will be logged.
You shouldn’t have to change these error reporting options. If you would like to, be sure you have a good reason as it could cause Snapshot not to work as normal even when everything’s fine.

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.

The PclZip compression option is selected by default in the Snapshot Pro global settings page.
If your site is hosted on a shared server, these options will need to be considered carefully since this setup typically has less allotted resources available than VPS or dedicated servers.

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 "Add New" buttons beside the destinations Amazon S3 and Dropbox are highlighted. The destinations have not yet been created.
These are just two of the five options you have for external backup destinations.

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.

The "add Snapshot Destination" setup page for Dropbox. The "Destination Name" has been set to "Work Account."
You don’t have to enter something meaningful for the Destination Name if you don’t want, but it is a required field so you do need to type something.

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 snapshot information section shows the name field filled out to read "Daily Snapshot." In the notes field it reads: "Post-2015 site redesign."
The Notes field can help you remember important details about the snapshot you’re creating to help you keep organized.

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
The "What Files to Archive" section of the "Add New" snapshot page. The option for including selected files is selected, and all file types have been checked off. In the excluding files box to the right, the folder "/uploads/really-large-files" has been included.
You can also exclude files and folders for the particular snapshot you’re creating. Just as in the Settings page, you do not need to enter the full path to a file or folder, but don’t forget to type in the parent folder.

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.

The backup interval is set to once daily and the start backup time has been set to 3:30 AM.
You can choose to schedule backups every few minutes, by the hour, daily, weekly or monthly. You can also choose to run backups once or twice daily, weekly or monthly.

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.

A previously created Dropbox destination called "Work Account" has been selected from the drop down box labeled "Work Account."
If you would like to create more destinations, you can click the Add more Destinations link to the left, but your current snapshot won’t be saved.

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.

A backup is in progress and the database tables are listed, each with their own progress bar. The current table being backed up has an "Abort" button to the left of its progress bar. The button is highlighted.
When your snapshot is done, a notice will appear on the page to alert you of the successful backup.

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 completed snapshot reveals other options including edit, run now, restore and delete. The "restore" link is highlighted.
On the All Snapshots page, you can also view the interval, destination and archive logs of each snapshot.

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.

A Dropbox URL has been entered on the Snapshots > Import page and the "Scan / Import Snapshots" button is highlighted.
If a snapshot should be listed on the All Snapshots page, but it isn’t, you can import it here to include it.

There are additional tips on the Import page to guide you through this process in case you get stuck.

Conclusion

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 SiteWordPress 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.