Creating a backup in Moodle

Creating a backup in Moodle

Every now and then you come across a situation where you wish that you had taken a backup of your course in Moodle before you started making changes to the content or settings. If you are not careful while making changes, you might end up losing:

  • Student grades
  • Completion status
  • Course / Activity completion dates etc.

So to make sure you do not lose any data, you should take a backup of the course before you start making changes.

Moodle can be backed up in a number of different ways. It is important that whoever performs your Moodle backup knows what they are doing. You can use the following backups methods to perform backups for your Moodle installation:

Course Backup

Moodle allows you to backup individual courses as and when you need them and you can automate that too using the automated backup functionality. If you need to backup a single course in Moodle and or move a course from one Moodle site to another then a course backup is the easiest way to do it. Any user with editing rights can backup a course along with the user data and grades.

To perform a course backup, follow the steps below:

  1. Navigate to a course you wish to backup
  2. Under Course administration click Backup
  3. You will be prompted to select what you want to include in the backup or just keep the default settings and click Next or Jump to Final Step to move all the steps and perform the backup
      • Please note: Course Logs and Grade History can be included in the backup, but are not selected by default. You can also Anonymize user information.

    Moodle backup settings

  4. On the Schema settings – Select/deselect specific items to include in backup, then click the Next
  5. Review the backup settings and click Previous if wish to make a change, otherwise click the Perform backup 
  6. Click the Continue


Course Backup (Automated)

To setup automated backups, follow the steps below:

  1. Navigate to “Site administration” -> “Courses” -> “Backups” -> “Automated backup setup”
  2. On the following page you need to set the following:
    • Active: Set this to “Enabled” to enable the automated backups
    • Schedule: Select the days that you want to run the backup. Backups can consume quite a few resources so you can set them to run on specific days.
    • Execute at: As mentioned above, backups need system resources, so you can schedule them to run on a specific time when the server is not that busy.
    • Automated backups storage: By default the backups are stored in Moodledata directory but, you can use this setting to change it to another directory on the server or use both.
    • Save to: If you decide to store the backups somewhere else too, use this setting to define the directory where you want the backups to be stored to.
    • Delete backups older than: This is similar to the setting above.
    • Minimum number of backup kept: If backups older than a specified number of days are deleted, it can happen that an inactive course ends up with no backup. To prevent this, a minimum number of backups kept should be specified.
    • Use course name in backup filename: You should use this if you want the course name as part of the backup filename.
    • Skip hidden courses: Do you want to skip hidden courses during the backup.
    • Skip courses not modified since: You can choose to skip the course if it hasn’t been modified for a certain time period.
    • Skip courses not modified since previous backup: You can also skip the courses that have been not been modified since your last backup.

Once setup, the administrator will get an email each night (depending on the schedule set above) after the backup is complete.

Site Backup

If you need to backup your entire Moodle site, then a site backup allows a site administrator to save everything associated with a Moodle site. These backups can be restored to bring a site back to the point in time when the backup was made.

You should always perform regular backups to safeguard against data lost information in the event of problem with your site and to speed the overall recovery process.

The following three items need to perform a complete site backup:

  1. Database
  2. Uploaded files (Files uploaded via Moodle in the moodledata directory)
  3. Moodle code (Everything in server/htdocs/moodle)

If you are unsure where to find these items are located in your Moodle installation by checking the config.php file.

Need further help?

If you need assistance with backing up Moodle, improving the performance of your site or an Moodle Health Check to ensure your LMS is running correctly, get in touch with us today.