You gotta love a good backup. A few months ago I found that I didn’t love backups enough. Or at least I hadn’t been paying my backup processes nearly enough love. We won’t even talk about whether or not I’d ever fire drilled a recovery. A simple mis-typed command into a linux terminal while necessarily logged in as the root user started me on a path of learning that a neglected relationship with your backups leads only to pain.
Since this horrific ordeal I’ve come to be considerably more of an expert in backups than I was previously. Here’s a run down of the various backup methods I’ve tried and or now employ to ensure I’ve got things covered, including their pros and cons when it comes to attempting to restore.
First off I’ll give you some food for thought on what your situation might be, then I’ll give you some tips on how to improve things.
If you are a web hosting customer of whoever, know what is being backed up
Shared hosting
Shared hosting, not normally called shared hosting, but if you’re paying a few quid a month on hosting, you’re on shared hosting. These services are pretty much always backed up, to an extent.
Shared hosting essentially means your websites, the files and databases are on a server with other people’s websites, their files and databases. As you share an operating system and the hardware (memory, processors, hard disks – at least in a virtual sense), all this will be managed by your hosting company. If they make a mistake, they better hope they’ve got their customer’s data backed up and are able to restore it quick smart but they will likely not take any responsibility for the impact to you or your business for downtime during a restoration.
It’s worth checking your shared hosting Ts&Cs to see what the deal is on your hosting package.
[bedev_widget_area]
VPS & Dedicated Server
So contrary to share hosting, here it’s unlikely that your hosting provider has your back when it comes to securing your stuff. Here’s a list I find useful when it comes to backups to make sure I have everything covered. Ask yourself, if your server disappeared tomorrow, how quickly could you restore:
- Your server software, including – operating system, php, apache, nginx, apache MySQL files and updates
- Your server control panel, including – domain settings, DNS settings, account settings for resellers
- Your websites files
- Your website databases
These tend to come in a couple of different flavours – managed and not managed. If managed, you may find that they take care of the first couple but it’s worth checking. It’s rare that backups for the second two are included as part of a standard package. Even though they might sell them as extras, just consider whether you want your backups stored in the same place as your server, ehem, 123-reg…
Cloud Servers
Here I’m really talking about those who have their own servers and VMs spun up on services like the Google or Microsoft Clouds. These services should be pretty solid, you hope, but you can still backup an entire sever image in one, perhaps not the best for a regular backup, but before and after any major updates it could be a good way to keep hold of stable versions of your systems.
Hosted / Managed Website Services
Now here is somewhere you definitely want to check what your provider is doing to look after your site(s). It’s common that you won’t have any access to files or databases, and with a CMS like WordPress you probably won’t have the ability to install any backup plugins. If you want an extra layer, you can always look at regular exporting your content and storing it somewhere.
OK, so make sure you know what’s being backed up, now, how can you go the extra here?
Via Control Panel
For those using a popular server control panel such as cPanel, Plesk or Direct Admin, you’ve got a few easy options at your disposal.
In the Tools & Settings look for “Backups” or “Backup Manager“. These tools will normally allow you to schedule backups of your control panel configuration – your settings, domain settings and customer settings for resellers – as well as your files and databases.
You should also get options to store these backups in a remote location via FTP. Use this option. What? Your hosting costs just went up from needing another server to store this stuff on? A necessary cost.
Another handy setting is incremental backups. Setting these every hour or so will mean only files that have been added, removed or changed will be added, removed or changed in the backup location. This can be great for going easy on your server’s resources. While a daily snapshot / total backup can give you something to roll back to if you need to, in case of a hack, for example.
Resources:
CMS
I’m really only an expert in WordPress here, so let me tell you about a few good options.
I mentioned using the WordPress export functionality already (under tools). Though not ideal as you can’t automate, plus this actually only generates an XML file, i.e. text only. Obtaining your images later via this method actually relies on them still being in place on your server.
Here’s some other plugins that might make your life a bit easier:
iThemes Security
A classic for securing WordPress, and one I recommend every time, especially given that the free version is actually pretty damn good. A feature of the free version is automated daily database backups that can be sent to you by email. Make sure this is sent to an email that IS NOT hosted on the same server as your website…
Resources:
Backup Buddy
Also from iThemes, a well renowned backup plugin that can backup your files and databases at regular intervals and automatically send them to remote locations. Backup Buddy also makes it very easy to restore from backup files which can be used to recover from a rogue plugin or user error.
Resources:
WPMU’s Snapshot Pro
My favourite plugin for backups in WordPress, mainly because it’s great for WordPress Multisite Networks. You can set the plugin to backup a specific sites files and or it’s database tables. I’ve been able to use it in the past to restore a site to a version backed up an hour ago whilst not touching or impacting any other sites on the network. A missing feature is the ability to backup the entire network in one, but word on the street is that this is in the pipeline, along with remote storage for WPMU members to go alongside it’s current FTP, GDrive, OneDrive and DropBox options.
Resources:
Some others that may interest you
Mover.io
Got to give a shout out to Mover.io. This service can be used not only for backups but also migrating files between numerous other services including OneDrive, GDrive, DropBox (for free I might add) as well as “Premium Connectors” like FTP and sFTP for $20 / month. This can be used to effectively create a mirror of your website’s files on another web server, FTP storage server or cloud storage service like the ones mentioned above.
As with other method mentioned here, the incremental option is a powerful one enabling an hourly update of files that have changed since the last run.
Something to watch for – if you delete files from your website, they are not deleted from the mirror which adds an extra thing to think about if using it for restoration.
Something else to watch for – an hourly process like this requires Mover.io to login via FTP every hour and check through the created and modified time stamps for every file, thisĀ can be a little intensive on server resources.
Databases
A clear shortfall of using a service like Mover.io to backup via FTP is that it won’t include your databases. Not to worry, dumping your database into your website directory on a regular basis will include it in one of your regular incremental. Just be sure to update the dump file’s permissions so that it isn’t publicly accessible.
Here’s some methods you can use for this:
- MySQL Export – via phpMyAdmin, click the export tab and export an SQL file.
- Cron MySQL Dump – set up a cron or scheduled task containing the mysqldump command to save a copy of the database
- WP CLI DB Export – If you are using WordPress, installing the WP CLI utility and using the wp db export command will pretty much do the same as mysqldump but will take care of the username and passwords for you
So there you have it
Some food for thought for many I’m sure. I’m not sure that I ever would have focused on my backup processes so closely if I hadn’t had to experience a disaster first hand, so perhaps a blessing in disguise.
Of course having backups is only one half of the game, ensuring their integrity and knowing how to restore, and restore quickly, is the other half. I’ll come to that soon.
Please use the comments board to share you’re preferred methods of backing up!
[bedev_widget_area]
Leave a Reply
You must be logged in to post a comment.