Your premium source for custom modification services for phpBB

HomeForumsBlogMOD ManagerFAQSearchRegisterLogin

Comments September 4, 2009

Board Backup Strategies Part I: What To Include

Filed under: Backups, Board Management, phpBB — Dave Rathbun @ 8:07 am CommentsComments (6) 

A while ago I posted about a software product that lets you run backups and store them on Amazon.com’s S3 data center service. It was an interesting idea, but mostly it got me thinking about how to determine an optimal backup strategy for other board owners. I do my backups every night. I guess I should actually say I never do backups; I have a script do them for me instead. :) That’s one aspect to consider when setting up a backup strategy for your board.

For this post I would like to cover what are probably some fairly obvious concepts for experienced board owners. The first question that needs to be asked is: What do I need to include in my backup strategy?

Code and Data

There are two components of your board: code and data. If you need to move or restore your board you need both parts; one is useless without the other. I will submit that data is more important than code. If you have code with no data, you’ve lost what makes your board unique. If you have data with no code, you can at least download a free set of code for phpbb and use it. But the question remains… what should I include in my backups? The answer is, of course, both.

Backing Up Source Code

There are some folks that run very sophisticated code management systems. They might include SVN (an open source code management system, link at end of post) or something similar. I don’t do that. Sometimes I wish I did but I have never needed anything that complex because I am the only developer on the system. I don’t have to deal with supporting more than one developer. I could use a system like SVN for tracking code changes, but so far I have not needed anything that sophisticated.

But I do back up my code. It’s not done on a scheduled basis, because code changes only happen when I make them. I started off on a tangent about my development process and decided to move all of that information to a new blog post rather than here, so for now let me just assume that there are code changes that happen. Before I put new code onto my production web server I will make a copy of the existing code and keep it easily available on the server. If some sort of bug managed to slip through my testing, I need to be able to fix it immediately, or if I cannot, I have to copy the old code back so that the board doesn’t go down. Once the the board has been updated and verified then the copy of the code will be downloaded off of the server and archived on my home network. I include a “readme” file that details the changes made and store it with the copy of the code.

I then will also make a copy of the current production code, and that is also downloaded to my home network. In the event of a hardware failure I would restore my code backup to a new server and follow that with my most recent database backup and my site is up and running. Which brings me to the next concept…

Backing Up Your Database

Code is not supposed to change unless you know about it. :) Database content can literally change every second. For that reason it is much more important to make regular database backups as compared to your code backup process. How often do you back up your database? There is a simple answer to that… how much data are you willing to lose?

I used to run my database backup process on Saturdays. That worked fine until I messed up the database on Thursday afternoon. By going to my backup file I lost everything that happened from Sunday through Thursday afternoon, or over 100 hours of board activity. With the level of activity I had at the time, that was about 50 new users. :shock:

I now run my backup process every night, so the maximum data loss would be one day rather than 4+ days that I had lost before. Of course my board is a lot more active today than it was years ago. An average twenty four hours of activity on my board today is:

  • 31 new users
  • 387 new posts
  • 77 new topics

Are daily backups enough, given this information? For now, yes. At some point I may shift to capturing the data every six hours (four times a day) to cut down my potential losses, but for now I am comfortable with these numbers.

Next Post: Database Backup Scripts

In the next post I plan to go into more detail about how I manage the automatic database backups. It’s fairly simple (which is good) and automatic (which is even better).

Related Links

  • Subversion Code Management


  1. I agree with doing daily backups for priority data! Over the 4.5 years that my forums have been running, I’ve lost about 8 days in total due to having to restore an old backup. But it could have been a lot worse. Today, I have a few databases powering different features of my site, and not all of them have the same priority. Some get backed up every day, some once a week, and just others once a month. Just depends on how important they are, and how often the data changes in them.

    Comment by Dog Cow — September 4, 2009 @ 11:21 am

  2. I have contemplated setting up more frequent backups for the database. I considered doing it every six hours (four times daily) but my current backup strategy involves using mysqldump and it takes a few minutes to run. I used to take the board offline during the backup (my script would simply update the phpbb_config table, setting the board disabled flag to 1) but eventually I decided to drop that step.

    In order to do extra backups during the day, I would want something less intrusive, and so far I have not had time to investigate the “hot copy” option for MySQL.

    It’s on the list. :)

    Comment by Dave Rathbun — September 6, 2009 @ 9:22 am

  3. Someone at phpbb.com pointed out (by asking a question) that the attachments are not being backed up by my current strategy. :shock: I am going to have to address that soon.

    Comment by Dave Rathbun — September 7, 2009 @ 8:44 am

  4. I actually count uploaded material as part of the files/code backup. I have one directory called simply ‘upload’ which has sub-dirs for avatars, gallery photos, attachments and such. However, since I don’t backup the files so often, this upload directory doesn’t get backed so often, either.

    Comment by Dog Cow — September 8, 2009 @ 10:37 am

  5. I never back up avatars, never even thought about it since I don’t consider that critical data.

    Do you really mysqldump your entire database? I don’t think I could do that with the size of the Forums, etc., it would just take too long. Maybe if I skipped the search tables… I do back up the users and a few other tables every night via mysqldump and cron, I’m guessing via a similar strategy. Another script runs every week or so using hotcopy with the web site “turned off” for a period of 10 minutes, which I then FTP down to my machine. I backup my attachment-type data every 1-2 days via FTP.

    Comment by E — September 8, 2009 @ 7:38 pm

  6. Old post, but I would like to add mysqldumper.net (MSD) as a useful resource.
    The backup can be started via cron, and MSD is able to transfer the backup-file to other FTP-servers.
    It is also very helpful when moving to a new hoster and it is specially programmed to make backups of very large DBs. It is the solution when experiencing server-timouts, and it automatically detects charsets.

    Comment by Holger — June 7, 2011 @ 2:00 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress