Confessions of a Six Figure Professional Blogger

Developing a Blog Backup Strategy – How?

Most bloggers put a lot of time and effort into their blogs. Now, wouldn’t it suck if something happened to it and you couldn’t recover? Oh yes, it would. The answer to this blogger’s doomsday scenario is a solid backup strategy.

hardrive_000 Unfortunately, it seems as if most bloggers don’t really pay as much attention to this as they should. It is common for bloggers not to even think about it and they thus rely on their web host to do it for them. This is NOT dependable. Many web hosts don’t back up every day. Plus, the horrific data loss over at Magnolia shows that there is no guarantee even with that.

Another option is to manually back up your Wordpress database using PHPMyAdmin. Many web hosts have this already installed and you can access it using your account control panel with your web host. Even if your host doesn’t provide it, however, you can install it to your own server yourself. Using the Export function of PHPMyAdmin, you can create backups of your database and save it as a file.

Another common option is to use the WP-DB-Backup plug-in for Wordpress. This is certainly a LOT better than depending on your web host. You can also set it up to run on automatic using Wordpress’s own internal CRON.

Here’s How I Do It

I do not want to depend on my web host for backups. They do do it for me, but I’m not willing to trust my business to them blindly. And I don’t want to depend on a plug-in to back up Wordpress. What if something happens and Wordpress isn’t functioning properly? What if PHP stops executing on the server? In other words, a backup system that depends on Wordpress itself to back up Wordpress is just not a fail-safe solution.

So, I do a few things:

  1. I keep a copy of all my blog files locally on my computer. I have a directory on my hard drive for each site I have.
  2. I run a series of independent PHP scripts to back up each of my databases. These scripts were written by me and are run each night in the early morning hours via CRON. The scripts are designed to create an SQL backup of the database, timestamp it, and archive it in a server directory which is not accessible to the public. I keep 7 days of SQL backups on file for each database at all times, and then I archive weekly backups into another folder on the server so that I always have 2 weeks of backups there. Each SQL file is G-zipped to conserve space.
  3. Using CRON on my Mac, and an Automator script which works with my FTP client (Transmit), my Mac logs into the server each and every night while I’m in bed. It will then download all backups to my Mac such that I always have ALL database backups on the server mirrored locally to my hard drive.
  4. And, of course, being that I am running a Mac, everything is backed up to an external hard drive by Time Machine.

So, as you can see, I’m not dependent on Wordpress at all. And I have multiple levels of redundancy. The database backups are stored on my web server (which is backed up by most host as well), as well as on my Mac on TWO separate disk drives.

For me, geographic redundancy is important, too. If, God forbid, anything huge ever happened in the city where my web server is located and it took out my server, I’d still be able to put my sites back together with another hosting company because I have most everything stored locally.

How Can You Do It?

This is already a more technical post than I would usually write for this particular site, but I want to leave you with something actionable so that you can set up your own blog data backup plan.

Below is a link to a text file. This is the PHP script which I use to backup my databases. Save the text file and reset the file extension to .php. Edit the variables at the top of the script with your database access information, backup locations, and the prefix. Upload this script, then, to your server and set up a CRON job to execute it automatically every night.

Click here for the database backup script.

I will leave it to you and your web host to set up a CRON job. Most hosts have some web-based way to do this.

To get the local backups on your computer, you will need to look into the scripting capabilities of your FTP client. Most good FTP clients have some way of executing FTP commands via the command line.

Under Windows, you would probably need to use some VB Script and execute it via scheduled tasks. However, I’ll be blunt: Windows sucks when it comes to dependably executing anything on a schedule. I know – I used to try.

My automated scripts perform flawlessly on the Mac, however. I recommend Transmit as an FTP client because it has hooks which are built into Automator and it makes it very easy to set up a script to execute FTP commands. I then use Cronnix to set up a CRON job on my Mac to execute the Automator script.

However you ultimately go about it, be sure to take the time to put a blog backup strategy into place. Some day in the life of your blog, you will be glad that you did it.

If you enjoyed this article, you might also like...

  1. Terrorism – How Internet Businesses Should Plan
  2. My Blog Was Hacked (I Think) – The Story
  3. Wordpress and Curing High Server Load
  4. Another Good PHP Email Application
  5. 6 Tips to Secure Your Website

Learn The Real Story On Blogging As a Business...

  • Get immediate FREE access to the Six Figure Blogger Blueprint
  • Get exclusive stuff NOT available on this blog.
  • Get the latest updates from the weird Risley man who runs this site.

Enter email:

  • I had one of my blogs hacked and sent the details to hostgator security. They told me that there was nothing wrong with it, even and although it had a whole line of urls to russian cracker sites on it.

    Nightmare, learn't my lesson after that.
  • Good tips about automated back ups.
    I'm backing up my blog database with PHPMyAdmin and the files i just download them via FTP. I do store them on my local hard drive AND an external hard drive.
    Actually i have two copies of all photos and documents, not just the blogs. Better safe than sorry.
  • This is SOOOOOOOOOO important, I had lost data due to a hard drive failure and did not have a backup. Back up people! Don't get lax about it, do it daily.
  • Great advice, David. I would take it one step further and keep a backup of your work / site / files somewhere other than your office, like a bank deposit box or a relative's place as added insurance.

    This actually should be done even if you don't have a blog or web site!

    Wesley
    The Geek Entrepreneur
  • Janice
    Hi David,

    This is a great post. I understood most of what you said, but lost towards the end.

    It would be great if you somehow show the steps involved in a video.

    Thanks
  • Thank you! I always (kind of paranoid over here) worry about the possibility of all this work going down the drain. Yes, yes, and yes on the backups.
  • The timing of this article could not be better. I just lost a few months worth of blog post because of an issue with my host. I had some of the earlier post backed up, but I had not run the back up in a while. I know better now. and I will use the script to update from now on. Thanks
    Junius Fullard
  • So important! Not even for a blog, but for all business documents, family photos, things you don't want to lose in general! Thanks for the suggestions for the blog backup!
  • Linux and BSD web hosts (and I have NO idea why you'd use a Windows host!) often have ssh login ability and if so you can use scp and that in turn lets you use more sophisticated tools like "rsync" and "rsnapshot". On Mac/Linux , scp and rsync are part of the distribution and rsnapshot is a freely available Perl script. I have introductory articles on all those at my site.

    By the way, Mac Time Machine uses the same scheme as Rsnapshot - it's basic concept is the same (some details differ).

    Windows users needn't feel left out: "pscp.exe" is free to download and "rsync" is easily found too. You can't do rsnapshot on Windows because the filesystems can't support it.. yet another reason to buy a Mac :-)
  • I was thinking about this recently and I love what you wrote here in this post, thanks .. you are great!
blog comments powered by Disqus