I mentioned in my Blogging security tips that backups are very important. Backing up is one of the most important things to do when running a website. There are so many things that can go wrong. Especially if you’ve been blogging for years, you really cannot afford to loose all that data that you’ve worked so hard for.
So the next question is how you backup your WordPress based blog? WordPress documentation page WordPress Backups is a good start. It points out that it is essential to back up your database: Your WordPress database contains every post, every comment and every link you have on your blog. If your database gets erased or corrupted, you stand to lose everything you have written. Backing Up Your Database page gives tips how to do that. The methods vary somewhat depending on where you run your WordPress (which hosting company or your own server). Your hosting provider might actually be doing that for you, but wouldn’t it be safer if you didn’t have to rely all your data on a third-party? Of course you can use different WordPress plugins for automated backups or manually back up using database and file server programs. Many of the ways are described in the WordPress Backups entry in the codex.
There are also other important parts that needs to be backed up (maybe less often because they usually do not change often). Your WordPress site consists of the following:
- WordPress Core Installation
- WordPress Plugins
- WordPress Themes
- Images and Files
- Additional Files and Static Web Pages
All of these are used in various combinations to generate your website.
If you are running WordPress on your own server or hosting company where you have shell access, then one option to consider is to use a shell script to back up your data. If you make a suitable shell script for that, you might even be able to automate it to run periodically (using cron) and even copy backup files to some other backup server.
A Shell Script for a Complete WordPress Backup article gives instructions how to write a quite simple shell script to create a full backup archive of the website’s directory, including the WordPress core, themes and plugins, and most importantly, the uploaded content. The content is stores in a full database dump. All the parts are stored into one gzipped archive file. The file names are automatically dated, so you know when the archives were created and which are safe to remove. This script (with few customizations) has turned to be a very useful tool.