Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Site Backup for Low-tech Users/RewriteDraft.

Site Backup for Low-tech Users/RewriteDraft: Difference between revisions

From MoodleDocs
Line 24: Line 24:
The course backups and restores only deal with parts of the moodledata folder and MySQL tables.  For example, they may include reference to a default theme or a contributed code module, but not the actual code or information that will make them work.
The course backups and restores only deal with parts of the moodledata folder and MySQL tables.  For example, they may include reference to a default theme or a contributed code module, but not the actual code or information that will make them work.


== Old 6,7,8 The Steps to a Low-Tech Site Backup ==
== The Steps to a Low-Tech Site Backup ==
==


== Backup up key folders==
== Backup up key folders==

Revision as of 15:55, 24 February 2010

link back to real page
This page is written for Moodle site administrators who are interested in learning about site backup and restore process, but who are not familiar with code, command lines or website administration. For others please see Site backup

TIP: Please remember there are many different configurations for webservers and Moodle sites. Most of the instructions should start with the words "Generally speaking".

A complete Moodle site backup involves 3 things: the Moodle code, the moodledata folder and the MySQL table. A course backup and download off site is always a best practice but it only involves parts of the moodledata folder and SQL table.

Before disaster strikes

When a major Website disaster happens, you may need to restore the three parts:

  • moodledata folder - sometimes called the: data files, Moodle files, data directory, uploaddata, dataroot, or simply moodledata (in lowercase). It is not called the "database".
  • MySQL or PostgreSQL database - We will refer to the MySQL database. There are other SQL flavors which can be used.
  • Moodle code - location of Moodle code.

Thus it is a good idea to first know how to backup these parts.



Course Backups - better than nothing

As the site administrator, you probably have set an automatic course backup in your site settings. Sometimes site administrators forget that these backups should be copied to a safe place other than their webserver. Teachers maybe encouraged to download their course(s) backups to their computer on a weekly basis.

The course backups and restores only deal with parts of the moodledata folder and MySQL tables. For example, they may include reference to a default theme or a contributed code module, but not the actual code or information that will make them work.

The Steps to a Low-Tech Site Backup

Backup up key folders

You will need a program and rights to go into your website files to make a backup. You can copy the folder to another off site location, or zip the folders and copy that zip file to another location.

An FTP (file transfer protocol) program might be useful. There are free programs such as CyberDuck and FileZilla. A FTP program copies a file from "there" (the server) to “here” (your desktop). Usually this is as simple as a drag and drop and then waiting for the files to transfer.

Some webhosts will have an interface that will allow you to create a zip or tar file and download it. Similar to a FTP program.

Back up your moodledata folder

Use your program to copy (that is, drag and drop) the directory called “moodledata” or the zip or tar file you created that contains this folder. This folder was named and created in the install process. It usually located in a public directory, not in the same directory as the moodle code folder.

Backup the moodle code folder

Use your program to copy (that is, drag and drop) the directory that contains the moodle code. This directory is usually called "moodle" and maybe in the public root (htdocs). You may have created a tar or zip file of this directory and it's contents.

Backup the MySQL database=

Backing up the MySQL database is a different process. Here is a video of the process.

MySQL can be thought of as a series of databases. Each database is made up of tables that share a common prefix in their name. Each table has records. The Moodle intaller creates the Moodle tables prefix. A typical prefix is "mdl_". The goal is to backup these tables.

Open phpMyAdmin

phpMyAdmin can be installed as part of the Moodle interface. When installed it can be found in the site administration block>Server>database. Many webhosts will use a program called cPanel, or have a link to program that can manage the MySQL database. We will use phpMyAdmin.


Open phpMyAdmin. In the left pane, you will see your database(s) listed. Normally, the name of a Moodle database will be something like mdl_ or have the description Moodle. Click on the database you want to back up.

The page will refresh. In the left column you should see all (around 200) the tables with the prefix of mdl_ (or what ever they were named when the Moodle site was installed). Along along the top you will now see a row of buttons. Click on the button Export.

You will see boxes with options in them (see below).

Enlarge to see an example of phpMyAdmin screen shot
  • Check “Select all. ” In the Structure box
  • Click “Add DROP TABLE, etc.”
  • When in doubt, leave a setting at it's default
  • Go down to the bottom and find “Save as file”

it is a good idea to today’s date to the default name.

  • Select the compression method (here we selected gzipped)
  • Press Go in the lower right corner

A popup window will ask you whether you want to save the exported file. Click OK (Save). Wait for the process to finish.

phpMyAdmin will zip a copy of your database and send it to your home computer’s desktop.


Whew that is it!

Tips and tricks

Useful and free books

Every Moodler should download the free book Using Moodle 2nd edition in .pdf. https://docs.moodle.org/en/Using_Moodle_book It tells you all about how to create Moodle courses. Its final chapter (16) describes basic system administration, including how to automate the backing up of your courses. That automated course backup is really simple and you should do it.

The rest of Using Moodle’s final chapter explains the administration settings on Moodle’s front page. All those explanations are vital. However, Using Moodle does not tell you how to backup your whole site.

Old 1 Site Backup for Low-Tech Users

It is a good idea to reread the two Moodle FAQs: Beginning_Administration_FAQ and Beginning_Administration_2_FAQ

Also, revisit cPanel, which is a common webhost interface, where you manage what you have on your hosted server space.

You probably used cPanel when you installed Moodle. It includes File Manager. In addition, cPanel includes phpMyAdmin. This utility will be used to back up and, if necessary, query your database. PhpMyAdmin is documented in language that presumes computer expertise. But phpMyAdmin is used by Moodlers in videos you can find on the Web (on, for example YouTube).

Another Site Backup

Finally, if you have a spare computer capable of Internet connection, you can create a backup/test Moodle site.

Temporarily connect that computer to the Internet. Download the Moodle package or "appliance" appropriate for your operating system, such as MAMP [1] or another one of the packages described here: [2]

Create as many empty courses as you have on your site. Then increase the upload limit: on your front page, under Administration>Security>Site policies, find Maximum upload size and increase it to whatever you need for your largest course backup.

Then go into each empty course, and use Administration>Import to import your course backup. Don't forget to import your glossaries and front page.

Now you have a test Moodle. It’s not secure; so don’t open it up to the Web. But you will have a complete, working copy of your site.


Old 4 Besides your courses, what should you back up?

To understand a site backup, you should know that Moodle software is supported by three other software packages. (These will be installed on your webhost’s server, and your host maintains and updates them.) In most cases, these three are the open-source (free) software programs called Apache (server software), MySQL (which creates and stores your databases), and PHP (the language in which Moodle code is written, and that allows Apache, MySQL, and Moodle to communicate). You can use alternatives to the Apache and MySQL "brand names," but you will always need all three types—plus the Moodle code itself.

It’s good to read the Site Backup FAQ [3] You will not understand everything, but that’s OK.

Experienced system administrators back up their sites according to instructions here: [4] But that page assumes that readers can write Unix/Linux commands and php code. If you cannot, the steps below should help you.

Old 2 Backing Up to Upgrade Moodle

Backing up in order to upgrade Moodle can raise the specter of databases whose default “collation” or “character set” is not exclusively the utf-8 that Moodle requires. You can see a discussion of this issue, relevant to those who used Fantastico to install Moodle, here http://moodle.org/mod/forum/discuss.php?d=140949

See also

Site restore for Low-tech Users - Or is this a mystery?