Backup Settings
Moodle provides a built-in course backup system that creates compressed archives of course content, activities, user data, and grades. Additionally, automated backup functionality can be configured to regularly back up all courses on the site.
Types of Backups
- Manual course backups: Initiated by teachers or administrators for individual courses
- Automated course backups: Scheduled backups that run via cron for all or selected courses
- Server-level backups: Full database and file system backups (not managed by Moodle itself)
Important: Moodle course backups are not a replacement for full server backups. You should always maintain regular backups of the database, Moodle code, and the moodledata directory.
General Backup Defaults
Configure default backup settings at Site administration > Courses > Backups > General backup defaults. These settings determine what is included in manual backups by default (teachers can override these when creating a backup):
- Include enrolled users: Whether to include user accounts
- Include user role assignments: Include role assignments in the course
- Include activities and resources: Include all course content
- Include blocks: Include course blocks
- Include filters: Include filter settings
- Include comments: Include user comments
- Include badges: Include course badges
- Include calendar events: Include course calendar events
- Include competencies: Include competency frameworks linked to the course
- Include content bank content: Include H5P and other content bank items
- Include groups and groupings: Include group configurations
- Include question bank: Include the course question bank
- Include custom fields: Include custom course fields
Automated Backup Setup
Configure automated backups at Site administration > Courses > Backups > Automated backup setup:
- Active: Enable or disable automated backups
- Schedule: Select which days of the week to run backups
- Execute at: Time of day to start the backup process (choose off-peak hours)
- Backup storage: Choose where backup files are stored:
- Course backup filearea: Stores backups within Moodle (uses moodledata storage)
- Specified directory: Stores backups in a custom directory on the server
- Both: Stores in both locations
- Backup destination: The path to the specified directory (if chosen above)
- Keep: Number of backup files to retain (older backups are automatically deleted)
- Minimum number of backups kept: Ensures a minimum number of backups are always available
- Skip courses not modified since: Number of days since last modification; courses unchanged in this period are skipped
Configuring What Gets Backed Up
In the automated backup setup, you can select which data to include. The options mirror the general backup defaults but apply specifically to automated backups. For large sites, consider excluding user data from automated backups to reduce file size and backup duration.
Monitoring Automated Backups
Check the status of automated backups at Site administration > Reports > Backups. This report shows:
- Backup status for each course (OK, Error, Skipped, Pending)
- Last backup date and time
- Backup file size
- Time taken to complete the backup
- Any error messages from failed backups
Backup File Format
Moodle backups use the .mbz file format (Moodle Backup ZIP). These files contain XML metadata and the actual course files in a compressed archive. The file format is versioned and generally backward-compatible, though restoring a backup from a newer Moodle version into an older version may cause issues.
Best Practices for Backups
- Run automated backups during off-peak hours (e.g., 2:00 AM)
- Store backup files on a separate disk or remote storage
- Test backup restoration regularly
- Keep at least 3 recent backups per course
- Monitor the backup report for failed backups
- Consider excluding user data from automated backups if storage space is limited
- Supplement course backups with full server-level backups (database + moodledata)