Best Backup Method/Approach

Best Backup Method/Approach

by Tad Bowman -
Number of replies: 5

I am new here and have enjoyed reading through the forums.

I do have a few questions, which other posts havent answered, about backups.

Will the automated backup provided a backup of complete database, or do I also need to back up the mysql database it case of a crash?

What if users are online during the time the automated back up is taking place?

I understand the two things I need to restore in case of a crash are the database and the moodledata directory, but should I do this with my script or is the best method using the moodle auto tool?

Also I'm not sure how the mysql data needs to be synced with the moodledata or is it one in the same?

Also is there a real need to do different types of backups like differentials vs full backups daily?

Thanks in advance for any support,
Tb

Average of ratings: -
In reply to Tad Bowman

Re: Best Backup Method/Approach

by Timothy Takemoto -
Tb
> Will the automated backup provided a backup of complete database,
No
> or do I also need to back up the mysql database it case of a crash?
Safer. Recommended.

> What if users are online during the time the automated back up is taking place?
Slows down the server. Do it at 4 am.

> I understand the two things I need to restore in case of a crash are the database and the moodledata directory, but should I do this with my script or is the best method using the moodle auto tool?

The moodle auto tool saves each course. A SQL script to dump the database would save the whole thing. I use a php script.

Using both the moodle automated back ups and a SQL/php database backup is probably the safest. A lot of servers do automated SQL database backups independently of users. Bearing this in mind, and in any event, the moodle auto tool is ample for many. I have vary rarely heard of anyone needing either. Mostly backups are used for moving, copying and sharing courses.

> Also I'm not sure how the mysql data needs to be synced with the moodledata or is it one in the same?

They are not one an the same. The moodledata is just a directory of files. You would need to make sure that the data goes back into the folder specified by the moodle datapath. If you move to a new server, you may have to change the moodledata path anyway. Then just put the datafiles that you have downloaded locally where moodle expects to see them. It is quite easy.

The difficult thing I find is that mysql and php time out during the process of restoring very large datafiles. Google this problem and you will find a lot of other people saying the same thing. It takes 10 minutes or more to restore a large moodle database. There seems to be several (timeout etc.) server settings to change and I have never seen a list of them. I have managed it by chopping the database into chunks. It is just a textfile.

> Also is there a real need to do different types of backups like differentials vs full backups daily?

Ooh...differential backups. You clearly know more about this than I. I guess you mean that you can write a SQL script to do a differential backup of your database. I did not know that could be done. It would save load on the server. I am not sure how much of an issue this for you is at 4am.

Tim
In reply to Timothy Takemoto

Re: Best Backup Method/Approach

by Tad Bowman -
Tim,

Thanks for your help I think you have helped me understand most of that. 

I still have one question you said.
"The moodle auto tool saves each course."

Does this mean inside the zip file, the tool creates, there are files to restore each class?  It doesn't appear that way to me.  The situation I would like to understand is this. 

Say you have one course where the data/grades/fourm something get corrupt and you need to restore it.  But you don't want to restore the entire site, because data in other courses are fine.  Can you use the auto backup to restore one course or do you need to have the courses backed up individually?

Thanks Again,

Tb


In reply to Tad Bowman

Re: Best Backup Method/Approach

by Timothy Takemoto -

Hi Tad

> Does this mean inside the zip file, the tool creates, there are files to restore each class? 

I am not quite sure of the meaning of "class," but yes, there are the files to restore each course. By default they are saved in the backup folder of each course.

By the way, you can specify an alternative path to a directory where all backups are saved using the "Save to:" field. One advantage to specifying an alternative path is that if someone deletes a course by mistake, and deletes its files with it, then the backup.zip file will have been kept elsewhere.

I have never had any need to restore an automatic backup (since there has never been any data corruption in my 2.5 year use of moodle)

The automatic backup setup screen
http://yoursite.com/moodle/admin/backup.php
has pretty much the same setting as any manual backup screen (except not quite so fine-grained, to the module level) asking what you would like to backup.

> Can you use the auto backup to restore one course or do you need to have the courses backed up individually?

The autobackup does not restore. It only does backup. Also, the auto-backup does *not* allow you to specify which courses are backed up. It is a site-wide setting and does the whole lot. 

The time taken to backup depends upon the size of the course, but with my bigish courses we are looking at a bit shy of a minute. Let's say you do your bacups at 4am. Even if you have a hundred large courses then your server will be pretty busy from 4 am to 5:40 am. If you have a lot of users (and then probably a dedicated server) it might be a good idea to tell the users not to attempt to use the site between those times. BTW my server does not have a php accelerator and it is not particularly fast.

Why do you want to auto-backup one course and not the others? Do you have a lot of courses and night-owl users? Or a global user base from various time zones? Backing up a lot of large courses does use server power. I guess that the desire to limit auto-backup to a subset of courses has not been an issue because most installations have users that sleep.

Tim

In reply to Timothy Takemoto

Re: Best Backup Method/Approach

by Tad Bowman -

>I am not quite sure of the meaning of "class," but yes, there are the files to restore each course. By default they are saved in the backup folder of each course.

I did mean course when I said class.  I had changed the default location for the backup files.  I was not seeing the files for each course in the individual courses backup folder.

>Why do you want to auto-backup one course and not the others? Do you have a lot of courses and night-owl users? Or a global user base from various time zones?

I don't want to backup just one course and not others.  I just want to make sure I can restore one course without overriding good data for other courses.  I am currently in a "research mode" looking into how Moodle would work for us.  This question was posed to me during a meeting, so I'm just trying to understand the backup system moodle has in place. 

I had been playing with the restore feature.  I reset the Save to: to blank and when I run backup it does not seem to save a file for each course in its backup directory.  Not sure if I have something wrong, it seems to be doing this for the auto backup also.  So maybe I have the cron setup wrong.

Thanks,
Tb
In reply to Tad Bowman

Re: Best Backup Method/Approach

by Timothy Takemoto -

Tad

I hope I was not being too pedantic here above.

> I just want to make sure I can restore one course without overriding
> good data for other courses.  I am currently in a "research mode"
> looking into how Moodle would work for us.  This question was posed
> to me during a meeting, so I'm just trying to understand the backup
> system moodle has in place. 

Hmm...Under normal circumstances there should be no problem. You can restore courses as new courses and that should not effect any other course.

If in doubt then one can restore suspect courses to a test moodle installation (you can of course have as many installations as you like, including on your laptop).

In the past I have had problems with my database when I have mixed Japanese character encoding sets. This is a very strange, avoidable and ill-advised thing to do. But *perhaps* if you were to restore a backup made in another encoding to your site then this might have ill affect upon other courses.

Tim