Page Index Toggle Pages: [1] 2 
Topic Tools
Hot Topic (More than 10 Replies) Backing Up and Restoring Your Boards (Read 25,971 times)
Curtiss Grymala
Past Team Members
Offline



Posts: 1,903
Backing Up and Restoring Your Boards
Oct 1st, 2005 at 4:42pm
Post Tools
I would like to see a page/section put together detailing how to properly back-up and restore your boards in case something terrible happens.  I'm just not certain where to put it.  I was planning on starting a new category under "Managing Your Community" titled "Backing Up And Restoring Your Boards", and then creating a number of articles under that category.
The article titles would be essentially as follows:
  • Backing Up Your Forums For The First Time
  • Performing Incremental Back Ups
  • Restoring Misplaced Or Lost Data


I will begin trying to put together these articles within this topic, and will gladly post them in the YaBB codex as planned, but I just wanted to make sure at least a few people thought I was placing them in a good spot on the codex.
  

You should always perform a complete back-up before making any changes or modifications to your forums.
Back to top
 
IP Logged
 
Curtiss Grymala
Past Team Members
Offline



Posts: 1,903
Re: Backing Up and Restoring Your Boards
Reply #1 - Oct 1st, 2005 at 5:04pm
Post Tools
Code
Select All
==Backing Up Your Forums For The First Time==
When using YaBB, it is very important to perform regular '''back ups''' of your forums, just in case something terrible happens to your data.  This article outlines the first step in performing regular back ups.

===Why Should I Back Up My Forums?===
Because YaBB's '''database''' is based on '''flat-text files''', it is necessary to perform regular back ups of your forums, as a few minor server errors can begin wreaking havoc on your boards very quickly.  In addition, with the popularity of YaBB increasing exponentially, hackers are bound and determined to find new security holes that they can use to wreck your forums and your site.  Therefore, it is extremely important that you perform routine back ups of your forums.

===Performing The First Back Up===
When you first '''install''' or '''convert''' your YaBB forums, you should perform a full back up of your forums.  Essentially, this simply requires you to download the entire ''yabb'' directory within your ''cgi-bin'', and the entire ''yabbfiles'' directory within ''public_html''.  If you have moved your Messages, Members, Boards, etc. directories outside of your ''/cgi-bin/yabb/'' directory, you will need to download those as well.

===Which Files Do I Need To Back Up?===
For your first back up, especially if you have converted from an older version of YaBB, or some other forum software, you will want to be certain you download the entire contents of the following directories:
:/cgi-bin/yabb/
::/cgi-bin/yabb/Admin
::/cgi-bin/yabb/Boards
::/cgi-bin/yabb/Help
::/cgi-bin/yabb/Languages
::/cgi-bin/yabb/Members
::/cgi-bin/yabb/Messages
::/cgi-bin/yabb/Modules
::/cgi-bin/yabb/Sources
::/cgi-bin/yabb/Templates
::/cgi-bin/yabb/Variables
:/public_html/yabbfiles/
::/public_html/yabbfiles/Attachments
::/public_html/yabbfiles/avatars
::/public_html/yabbfiles/Buttons
::/public_html/yabbfiles/ModImages
::/public_html/yabbfiles/Smilies
::/public_html/yabbfiles/Templates

===How Do I Download These Files?===
In order to download these files, you will need to login to the FTP part of your server.  You should use an '''FTP client''' to download these files.  Simply log in to your server, just as you did to upload the files originally, and begin downloading all of the files onto your harddrive somewhere.  You should make certain that you download the files in the correct format ('''ASCII/Binary''').

===How Often Should I Back Up My Boards?===
This really depends on how large and active your boards are.  If you have forums that only get one or two new posts/members each week, then a weekly back up should be more than sufficient.  If you have boards that get 30 to 40 new posts/members every hour, then you will want to do a back up significantly more often (possibly every hour).  However, it is not necessary to perform a full back up every time you want to back up your boards.  You can perform an '''incremental back up''' in most cases. 

  

You should always perform a complete back-up before making any changes or modifications to your forums.
Back to top
 
IP Logged
 
Curtiss Grymala
Past Team Members
Offline



Posts: 1,903
Re: Backing Up and Restoring Your Boards
Reply #2 - Oct 1st, 2005 at 5:57pm
Post Tools
Code
Select All
==Performing Incremental Back Ups==
No matter what size your forums are, you should perform routine, '''incremental back ups''', in order to prevent serious data loss.  This article will detail which files you should back up on a routine basis.

===Backing Up Specific Files On A Regular Basis===
There are a few directories that should be backed up on a regular basis.  The amount of time between incremental back ups really depends on the size and activity of your forums.  However, no matter how active your forums are, you should routinely back up the following directories:
:/cgi-bin/yabb/Members
:/cgi-bin/yabb/Messages
:/cgi-bin/yabb/Variables

===Knowing Which Files To Download===
When performing an incremental back up, it is not necessary to download any directory in its entirety.  You can actually save quite a bit of time by setting up your '''FTP client''' to download only new files, and only overwrite existing files if they have changed since your last back up.  To find out how to set up your FTP client to do this, you will most likely need to consult the documentation that came with that software, as it varies greatly between clients.  However, the concept behind the setting is the same in all clients that support this type of behaviour.

====Checking For Server Time Correction====
Before actually performing any incremental back ups, it is recommended that you go through a trial run first.  Find a file on your server.  Look at the date and time on that file (the "last modified" date).  Download that file onto your harddrive, and see if that date and time changes.  In many cases, the time will change by a few hours (forward or backward), which could cause you a lot of unnecessary headaches in the long run.  In other cases, your FTP client will actually set the ''last modified'' timestamp to the date and time you download it onto your computer.  Somewhere within your FTP client there should be a setting to correct this.
If the time does in fact change, you will need to consult the documentation for your FTP client to see if it supports '''server time correction'''.
Next, you should upload that same file back to your server (preferably in a new place).  Check to make certain the time and date didn't change again.

===Setting Up An Incremental Back Up===
Once you have verified that the server time correction settings are correct, so that you won't overwrite your previous back ups unnecessarily, you can begin setting up your incremental back up.  To do so, you will want to set up your FTP client to only overwrite existing files if the file in the destination directory has a modification date older than the remote file.

===Performing The Incremental Back Up===
Now that you have everything set up properly, you should FTP into your site and select the directories mentioned above.  Then, choose to download them into the directory where you performed your last '''full back up'''.  Your FTP client might ask if you want to perform a '''Smart Overwrite'''.  If it does, then you should say "yes".  Depending on your connection speed, and how active your forums have been since you performed your last back up, this may take a few seconds or it may take a few hours.

===Verifying That The Back Up Was Performed Properly===
Once the download is finished, you should take a look at the directories that you backed up, and verify that the new files were actually downloaded.  In addition, you should verify that the files that have been modified since your last back up were actually updated.  If not, you will need to take a look at your overwrite settings within your FTP client again.

===Knowing When To Perform A Full Back Up Instead Of Incremental===
There are certain times when a full back up should be performed instead of an incremental back up.  There are other times when you will need to perform a back up somewhere in between the two.  How do you know when to perform which back ups?

====Knowing When To Perform A Full Back Up====
Before you apply any mods to your forums, you should ZIP up your current back up directory on your harddrive and perform a new full back up.  Once you have applied the mod, you should once again zip up that back up directory, and perform a second full back up.  This will ensure that you can restore your forums from either back up very easily.

It is also a good idea to perform a full back up on a routine basis (once a month, once every six months).  Before performing any full back up, it is a very good idea to ZIP up your older back up, and possibly burn it onto a CD, just in case you ever have the need to use it for anything.

===Knowing When To Perform A Semi-Full Back Up===
Before you make any changes to your forum (upgrading to a new version, adding a new template, changing images, adding new smilies, etc.) you should perform a full back up as described directly above.  Once those changes are completed, you should perform a semi-full back up by backing up all of the files you would normally back up during an incremental back up, and backing up any files that you have changed/added.

===Knowing When To Perform An Incremental Back Up===
Obviously, you should perform an incremental back up on a routine basis, as discussed above.  Any time a full back up or a semi-full back up is not recommended, you should be performing incremental back ups.

===Tips On Extra Back Up Comfort===
In order to make your back ups more effective, it is recommended that you actually perform two separate back ups of your forums, in two separate places on your harddrive.  Then, when performing incremental back ups, you should alternate between updating each of those full back ups.  This way, in case you perform an incremental back up after something on your forums has been corrupted, you will have a fall-back to restore your forums.
As mentioned above, you should also perform full back ups on a semi-regular basis. 

  

You should always perform a complete back-up before making any changes or modifications to your forums.
Back to top
 
IP Logged
 
Curtiss Grymala
Past Team Members
Offline



Posts: 1,903
Re: Backing Up and Restoring Your Boards
Reply #3 - Oct 1st, 2005 at 6:40pm
Post Tools
Code
Select All
==Restoring Your Forums After A Disaster==
This article outlines some of the steps you should take to restore your forums, in the event that something happens to corrupt or remove your data.

===Where Should I Start?===
Before concerning yourself with restoring files from a back up, you should begin by using the repair functions built in to YaBB.  These features are outlined in the Admin Center section of the YaBB Codex.  A quick list of these functions is:
* Recount Board Totals
* Rebuild Message Index
* Recount Membership
* Rebuild Members List
Be sure to try these functions before attempting to restore your forums from a back up.  If they don't fix the problem, then you will need to restore from a back up.

===Restoring Your Boards From A Back Up===
Depending on what goes wrong with your boards, there are a few different ways to restore your boards from a back up.

====Restoring Members From A Back Up====
In the event that one of your members is accidentally deleted, or the member's data files become corrupt, you will want to locate that user's data files within your back up.  They should be stored within ''/cgi-bin/yabb/Members''.  All of your user's files should have filenames based on that member's username.  Before doing anything with those files, however, you should check the ''/cgi-bin/yabb/Members'' directory on your server to figure out which files were corrupted or removed.  If you find any files that are 0 bytes in size on your server, you will want to overwrite those files with the ones from your back up.  If you find that there are files missing from your server, you will also want to restore those by uploading them from your back up.
From there, you should '''rebuild your memberlist''' from the Admin Center.

====Restoring Missing Messages====
If you notice that some of your messages have gone missing, you should begin by checking with your moderators, global mods and administrators to be certain they did not remove the message.  You should also try to check with the user to make certain s/he did not remove their own message.
You should then check your ''/cgi-bin/yabb/Messages'' directory to make certain that the message really is missing.  You will need to know the '''Message ID''', which should be a 10-digit number.  Look for all files with that number as their filename.  If there is a file called xxxxxxxxxx.txt (where the x's would be replaced by numbers) within that directory, and that file is not a 0 byte file, then you will want to try '''rebuilding your message index'''.
If you find that the post really did disappear mysteriously, you should be able to restore that message simply by uploading it from your back up into the ''/cgi-bin/yabb/Messages'' directory.  You should upload all of the files with the appropriate message ID as their filename.  Then you should try '''recounting your board totals''' and possibly rebuilding your message index.

====Restoring Missing Boards Or Categories====
Restoring a missing board or category can be a good bit trickier than restoring a missing message or member.
'''Very Important Note:'''  Do not try to re-create the board or category from within your Admin Center.  In most cases, the board or category does still exist on your server, but the catalog of that board/category has simply been corrupted.  If you attempt to re-create the board or category from with your Admin Center, your old board/category files will be wiped out and overwritten.

=====Restoring Your Main Board/Category Catalog=====
FTP into your server and navigate to ''/cgi-bin/yabb/Boards''.  Locate the following files:
* forum.control
* forum.master
* forum.totals
You will want to download each of those files into a safe place on your harddrive, and open them in NotePad (or a similar plain text editor).  Look through those files and search for any mention of the missing category or board.  Most likely, you will find that the category or board has been removed somehow from one of these files.  If this is the case, you should attempt to restore the board or category by simply uploading the forum.control or forum.master file from your back up.

=====Verifying That The Board Was Not Actually Removed=====
Once you have restored your forum.control and/or forum.master file, you will want to verify that the board was not actually deleted.  To make sure, you will once again want to navigate to ''/cgi-bin/yabb/Boards'' and look for the '''board ID''' of your board.  There might be multiple files with that ID as their filenames.  For instance, if your board ID was gen_for, you may see the following files:
* gen_for.mail (this file will only exist if your users have requested notification on these boards)
* gen_for.txt (this file should exist for every board on your forums)
If the txt file is missing, or is 0 bytes, you will need to restore it from your back up.  If that file does exist, and is not empty, then you should be able to restore the board simply by following the steps above.
{{stub}} 

  

You should always perform a complete back-up before making any changes or modifications to your forums.
Back to top
 
IP Logged
 
Juvenall Wilson
YaBB Legends (Inactive)
*
Offline



Posts: 9,516
Location: #!/usr/bin/detroit
Re: Backing Up and Restoring Your Boards
Reply #4 - Oct 1st, 2005 at 10:04pm
Post Tools
Looks great to me Cheesy.
  
Back to top
WWWGTalkICQYIMAIM  
IP Logged
 
Tea-Master
YaBB Legends (Active)
*
Offline



Posts: 3,628
Location: Germany
Re: Backing Up and Restoring Your Boards
Reply #5 - Oct 2nd, 2005 at 12:47pm
Post Tools
i'm not sure but what is the "Maintaining Focus" category for?
  

--> also known as Agent Zed Wink
Back to top
 
IP Logged
 
Curtiss Grymala
Past Team Members
Offline



Posts: 1,903
Re: Backing Up and Restoring Your Boards
Reply #6 - Oct 2nd, 2005 at 6:01pm
Post Tools
Quote:
i'm not sure but what is the "Maintaining Focus" category for?


I think that might be something like you'd find at The Admin Zone, explaining how to keep your forums on track, in the niche for which they were originally intended (not expanding too far, or alienating your main audience).

Anyway - I went ahead and added that section and those pages to the codex.
  

You should always perform a complete back-up before making any changes or modifications to your forums.
Back to top
 
IP Logged
 
goldengate2
Full Member
***
Offline



Posts: 214
Re: Backing Up and Restoring Your Boards
Reply #7 - Oct 3rd, 2005 at 4:36am
Post Tools
Does anyone have a good way of backing up the boards? My forum was to large to just FTP the files over as it eventually frooze up my FTP program part way through a backup. YaBB 1 was nice since I had the backup mod installed.
  
Back to top
 
IP Logged
 
Monsen
YaBB Legends (Active)
*
Offline



Posts: 10,103
Location: Bergen, Norway

YaBB 2.3
Re: Backing Up and Restoring Your Boards
Reply #8 - Oct 3rd, 2005 at 6:29am
Post Tools
If your host is a unix server, you can just upload a small perl script that creates a tar file for you, which you can easily download. This is the script I use myself (Extremely simple, no error handling or the stuff, just something I threw together real quick when I needed it):

Code
Select All
#!/usr/bin/perl --

$dir = "./yabb2";
$file = "$dir.tar.gz";
$file =~ s/.*\///;
$cmd = "tar -czf $file $dir";

print "content-type: text/plain\n\n";
print "Archiving $dir directory with tar to $file\n";
system ($cmd);
print "Archiving Complete"; 

  
Back to top
 
IP Logged
 
goldengate2
Full Member
***
Offline



Posts: 214
Re: Backing Up and Restoring Your Boards
Reply #9 - Oct 5th, 2005 at 1:17am
Post Tools
Thanks for the script  Smiley

Where does the tar file get stored in the directory the script is in?
  
Back to top
 
IP Logged
 
Monsen
YaBB Legends (Active)
*
Offline



Posts: 10,103
Location: Bergen, Norway

YaBB 2.3
Re: Backing Up and Restoring Your Boards
Reply #10 - Oct 5th, 2005 at 6:23pm
Post Tools
Yes. The .tar.gz file gets stored in the scripts current directory.... That is easy to change, but I made it just to be able to grab some directories quickly, not to be an advanced tool.....
  
Back to top
 
IP Logged
 
CasRas
Full Member
***
Offline



Posts: 131
Location: Terra, the blue planet
Re: Backing Up and Restoring Your Boards
Reply #11 - Oct 10th, 2005 at 12:13pm
Post Tools
Hm, just thinking.
Why not put this little skript into the yabbpackage and make it executable via admincenter?
Would be of great help, don't you think so?
  

See ya  - CasRas
Back to top
 
IP Logged
 
Curtiss Grymala
Past Team Members
Offline



Posts: 1,903
Re: Backing Up and Restoring Your Boards
Reply #12 - Oct 11th, 2005 at 12:39am
Post Tools
CasRas wrote on Oct 10th, 2005 at 12:13pm:
Hm, just thinking.
Why not put this little skript into the yabbpackage and make it executable via admincenter?
Would be of great help, don't you think so?


Because it would only work on certain servers, and then we'd have a whole lot more "I can't get this to work" posts, I'm guessing.   Wink
  

You should always perform a complete back-up before making any changes or modifications to your forums.
Back to top
 
IP Logged
 
CasRas
Full Member
***
Offline



Posts: 131
Location: Terra, the blue planet
Re: Backing Up and Restoring Your Boards
Reply #13 - Oct 11th, 2005 at 6:35am
Post Tools
Ok,

than i'll stay at  the manual call of the skript. Wink
Can you please write one, which restores the forum the same way?
Sorry but i am not familiar with using tar, so i cannot do it  myself.

With these two files one can backup the forum make changes, if they fail call restore.cgi and the forums is running again.
  

See ya  - CasRas
Back to top
 
IP Logged
 
Monsen
YaBB Legends (Active)
*
Offline



Posts: 10,103
Location: Bergen, Norway

YaBB 2.3
Re: Backing Up and Restoring Your Boards
Reply #14 - Oct 11th, 2005 at 7:54pm
Post Tools
Restore is much more dangerous, as it would overwrite things, but here is the script. If $dir and $file is set to the same values as in the backup script, it will restore the same file that was created.

Code
Select All
#!/usr/bin/perl --

$dir = "./yabb2";
$file = "$dir.tar.gz";
$file =~ s/.*\///;
$cmd = "tar -xzf $file";

print "content-type: text/plain\n\n";
print "Restoring $dir directory with tar from $file\n";
system ($cmd);
print "Restore Complete"; 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Topic Tools
 
  « Board Index ‹ Board  ^Top