Nightly full site backups

Nightly full site backups

by Dwight Hawley -
Number of replies: 9

I've wound my way through the forum discussions which leave me disjointed at best as they all seem to address an "issue". I'l be sure to revisit when I get an "issue" but for now I have the luxury of starting from scratch.

What I would like to know is if anyone has a nightly full site backup regimen they are happy with? No, actually more than happy. The kind that leaves you alone at the lunch table at conferences when someone has been so careless as to ask this exact same question and you couldn't resist launching into a 2 hour ode to the magnificence of your particular approach over the one hour break and they have all save one brave soul gone back to the relative safely of the conference program.

The kind that let you sleep blissfully at night knowing that if worse comes to worse you can, within a 2 hour or so window, have a fully functioning site back up.

Also:

Does anyone image their Moodle installation?

Employ off site storage rotations?

Happy for any input of a solution you use and are absolutely thrilled to recommend.

Average of ratings: -
In reply to Dwight Hawley

Re: Nightly full site backups

by Peter Halverson -

Here is my take on backups.  The Moodle built-in backup system works but it is very slow and sometimes it fails for lack of resources.  Instead what I do is backup the SQL database and the moodle directories using terminal commands.

Here is what works for me.  There are three things to backup:

  1. The SQL database
  2. The userdata directory
  3. Moodle code    (This only changes when you upgrade Moodle or add features.)

I'm showing you the commands that are specific to my installation on a Centos system, a Hostmonster VPS account.  You will need to adapt these to your specific installation.

What's good about this approach is that its fast.  My setup has 150 students and two courses.  The time to back everything up is about five minutes.  The time to restore from backups is also about 5 minutes.

I hope this helps...

Peter Halverson


Command line backup of my Moodle database
mysqldump -p -u halverph halverph_mdle2 > halverph_mdle2.sql  

Command line backkup of moodle user data
tar cvf moodledata.tar ~/moodledata  (verbose)     OR     tar cf moodledata.tar ~/moodledata   (non-verbose)

Command line backup of moodle code directory
tar cvf moodle.tar ~/public_html/moodle  (verbose)    OR   tar cf moodle.tar ~/public_html/moodle   (non-verbose)

Average of ratings: Useful (1)
In reply to Peter Halverson

Re: Nightly full site backups

by Just H -

How do you restore a specific course out of that regime?

In reply to Just H

Re: Nightly full site backups

by Peter Halverson -

This type of backup won't allow you to restore a specific course. 

What it does do is get you back in business if a disaster happens and your moodle database or files are corrupted.  It gets you back to the conditions that existed when the backup was created.

If you really wanted to restore just a specific course, you could restore everything from this type of backup and then export or re-backup the specific course you wanted.  But that's a convoluted way to go.  I wouldn't recommend it.

Average of ratings: Useful (1)
In reply to Peter Halverson

Re: Nightly full site backups

by Ken Task -
Picture of Particularly helpful Moodlers

Depending upon what platform the Moodle runs under and how many courses + availabliity of space, one could set automated backups to manual - choose whatever options that make sense for a 'daily backup' (I'd designate a directory outside of Moodle.) and then run the moodlecode/admin/cli/automated_backups.php script from a cron job scheduled for non-prime time for site usage.

Those too, however, depending upon options choosen, may not render a backup from the day before ... if that's what the goal is.

Could also create a script to move files in the designated directory for the month ... *201503* to a 201503 directory.  Next time the other automated backups run, no files found so Moodle should backup courses for that date.

Might seek, a php scripted app that does what you seek.  Would run outside of Moodle.

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Just H

Re: Nightly full site backups

by Dwight Hawley -

My goal here was not to address specific course backup. The standard Moodle course backup works well for that. This was more a full site restoration in case of catastrophic failure OR as a backup to the course backup.

In reply to Dwight Hawley

Re: Nightly full site backups

by Dwight Hawley -

I'm very familiar with the basic concepts associated with Moodle backups. I was hoping to find, as Peter provided, something specific that someone was actually doing and felt comfortable using.

Peter's approach is in the documentation and referenced in the site, but it affords those just starting out a huge degree of comfort when someone says THIS is what I have been doing, it has been working and I can recommend it. There is also the issue of relevance. In order to be available to all users at all levels, Moodle docs and forums searches will often yield responses written to issues from as early as 2004 or so, and my goal is to always obtain insight from those using the current Moodle software and in production environs that more closely resemble those in use today.

If anyone could address how you manage offsite rotation / cloud storage I would be interested in that information as well.