Moodle Site Backup Guide

A Moodle site backup enables a website administrator to save everything connected with a Moodle site. These copies may be re-established to bring a website back to the point in time when the copy was made.

Performing routine backups are highly recommended to accelerate the general retrieval procedure and to decrease the quantity of lost information in case of an issue to the website.

Moodle Site Backup Guide

What should be backed up?

A Moodle system consists of three parts:

1. The data saved in the database ( for instance, a MySQL database)

2. The files that are uploaded (for instance, class and website files uploaded in Moodledata) situated via Moodle

3. The Moodle code ( for instance, everything in server/htdocs/moodle)

It’s possible for you to verify where all these matters are in a Moodle setup by assessing the config.php file.

1. $CFG-“>>dbname demonstrates the database name

2. $CFG-“>>prefix demonstrates the the database table name prefix

3. $CFG-“>>dataroot managements where the uploaded files are saved; and

4. $CFG-“>>wwwroot points to where the code is stored.

Suggestion

Generally, the database (“dbname and prefix”) and the uploaded files (dataroot) are the two of the most significant to duplicate on a regular basis. These include advice that can alter frequently.

The Moodle code (wwwroot) is significant as a back-up that is regular, as it is only going to shift when the the real code is altered through code tweaks and upgrades, add ons. You could consistently get a duplicate of the standard Moodle code from http://download.moodle.org so you just have to back-up the parts you added or altered yourself.

Developing a copy of your Moodle site

Database

The proper manner to back up your database depends upon which database system you’re employing. The instructions below are one method to backup a MySQL database. Another alternative would be to utilize a tool like phpMyAdmin to make a backup. The instruction manual for your database will give more choices.

There are a number of methods to do such back-ups. Here is an outline of a small script you’ll be able to run on Unix to copy the database (it works nicely to have such a script run by means of a cron job):

Character encoding

Ensure that the right character encoding is used by a database back-up. In many databases, use UTF8.

When dropping the whole Moodle database, test for potential character encoding issues. Sometimes, back-ups may not correctly encode the data all. This is going to lead to non-readable characters.

Hint: One option would be to use MySQL Administrator 1.1 or another tool that will drive a UTF8 dump of the data.

Database backups of Tools

PhpMyAdmin

It is the program of choice with the majority of web hosting providers.

MySQLDumper

It is a script of backup for the MySQL databases, written in Perl and PHP. MySQLDumper uses a proprietary technique to avert execution gap when running PHP scripts (the maximum. execution time is normally set to 30 seconds). MySQLDumper also cares for the encoding issues mentioned previously. In addition, it works with compressed files and permits setting up routine cron jobs for upgrading and upgrading to a remote FTP site.

Moodle site backup – Uploaded files (moodledata)

Through the Moodle interface, users can upload or create folders and files. All these are in a directory, frequently called “moodledata”. There are numerous methods to back-up or copy moodledata because they’re only files and folders.

  •  For instance, using a file transfer application, copy the whole moodledata directory to drive another place or computer. Instance of the file transfer applications include: FTP, WinSP, wget, rsync.

Suggestions

  • Usually not all moodledata files change between routine/periodic back-ups. A fresh System Administrator may need to explore alternative efficient back-ups processes or step-by-step.
  • Depending on the operating environment there are a number of applications for backing up server files and manners of backing up moodledata. SeeTools_for_backing_upward_server_files for tips about using Wget, FTP or rsync.

Moodle Code

Backing up the Moodle code, will be similar to backing up moodledata.

The procedure finishes with: “Error: An error occurred deleting old backup data”. What should I do?

This section of the copy (or restore) procedure attempts to delete old information, used in previous executions, performing these jobs:

1. Delete old records from “back-up_ids” table: Check the table exists, repair it and try again.

2. Delete old records from “back-up_files” table: Check the table exists, repair it and try again.

3. Delete old files from “moodledata/temp/copy”: Delete the dir completely and try again.

Copy Error Message

For points 1 & 2, there are various ways of fixing tables, including using MySQL Admin.

For point 3 see below:

The error message states that the “directory not empty” and gives the path to that directory. You’ll be able to find out what is there and clean up should you go there with an FTP software. It may be only some empty subfolders that were not consumed. Deleting these has been able to aid. One can likewise delete the dir “moodledata/temp/back-up” entirely. That could take a little more but may solve several issues simultaneously.

Moodle Site Backup

  • Download a Moodle backup file (.mbz)
  • An .mbz file could be utilized to renew the class on a distinct Moodle server, for instance, should you instruct the class at a distinct association
  • Because classes are taken out of the server following the ending of the session educated, it is wise to make a backup in the end of every term a class is taught by you. In the event you do not teach the class again within the 18-month window, our Moodle administrators can re-establish the class contents from the .mbz.

Note: The contents of the .mbz can’t be obtained from your computer (outside of Moodle). For instance, you can’t pull PDFs from the backup file, however if the class is restored on a Moodle server, files that were uploaded into the first class (or links to files saved elsewhere) will be in the restored class.

What’s contained in an .mbz back-up?

Back-ups contain most settings including Format, Subjects, Class End settings, and settings for Quizzes and Assignments, Actions, and Resources.

Back up files don’t contain:

  •  Groups
  •  Client Access settings
  •  Pupil registration
  •  Contributions to collaborative tasks (Wiki, Newsgroup, Glossary, Database, etc.) made by any class member, including the teacher.

Why back up class content separate of Moodle?

As the contents of an .mbz backup file is unable to be obtained outside of Moodle along with the back-up will not contain pupil data, you also need to back up class content in a type it is easy to get all on your own computer. Backing up your class content will be able to allow you to reuse class materials in future sessions and maintain a record of your pupils’ work.

Moodle site backup – Suggestion

It’s almost always wise to get several back-up duplicates of your Moodle code files. While you always have the option to download an original base copy of the Moodle code from http://download.moodle.org, you might have customized that code. It’s recommended before you customize the code to make another copy of your Moodle code. This consists of updating and installing Contributed code, Themes.

Understanding Moodle backup will ensure you have all important files saved.

Nicole Lewis is the Lead Author & Editor of MyLMStips. MyLMStips is dedicated to providing the most engaging topics, information, tips and tricks surrounding Moodle®. It's a place where Moodle® users can receive guidance on how to get the most out of it and increase their productivity and progress.