keepcalculator

06 Numbers and Powers

Upload & Restore Large Courses in Moodle

Card No. 06·38963 · Updated · Standard formula, shown below

This guide explains how to upload and restore large course backups in Moodle, covering file size limits, PHP settings, and the restore process. You’ll learn how to prepare your backup, adjust server settings if needed, and avoid common pitfalls that cause failures.

What You’ll Need

  • Moodle administrator (or a role with ‘Restore courses’ permission)
  • A course backup file (.mbz) that you want to upload
  • Access to your Moodle server’s PHP configuration (php.ini) if the file is large
  • An FTP/SFTP client or file manager if you plan to upload directly to the server

Step-by-Step

  1. Check your current upload limits. In Moodle, go to Site administration → Courses → Restore course. Look for the upload file size limit displayed there. If your backup is larger than this, you’ll need to increase it.
  2. Increase PHP upload limits (if needed). Edit your php.ini file and adjust these settings: upload_max_filesize, post_max_size, and max_execution_time. For a 1 GB file, set upload_max_filesize to 2G, post_max_size to 2G, and max_execution_time to 3600. Restart your web server after changes.
  3. Upload the backup file. Go to Site administration → Courses → Restore course. Click Upload a file, choose your .mbz file, and click Upload. Wait for the upload to complete—this may take a while for large files.
  4. Start the restore process. After upload, you’ll see the file listed. Click the Restore icon (a recycle symbol) next to it.
  5. Confirm the restore. You’ll see a confirmation screen. Click Continue.
  6. Choose the destination. Select whether to restore into an existing course or create a new one. For a new course, enter the course name, short name, and category. Click Continue.
  7. Set restore options. Choose what to include (e.g., activities, blocks, files, permissions). For a full restore, leave all options checked. Click Next.
  8. Review and confirm. Review the summary, then click Perform restore. This will start the process. Depending on the size, it may take several minutes.
  9. Wait for completion. Do not close the browser tab. You’ll see a progress bar. Once done, click Continue to go to the restored course.

Common Mistakes

  • Ignoring PHP limits: Uploading a file larger than the limit results in a ‘File exceeds maximum size’ error. Always check and adjust before uploading.
  • Using a weak internet connection: Large uploads can time out or fail. Use a stable connection or upload directly to the server via FTP.
  • Restoring into the wrong course: Double-check the destination course to avoid overwriting existing content.
  • Not including all file types: If your backup contains external files (e.g., from a repository), ensure they are included in the backup or available at restore time.
  • Running out of disk space: Large restores require temporary space. Ensure your server has enough free disk space (at least twice the backup size).

Tips

  • Use FTP for very large files: If your backup exceeds 2 GB, upload it directly to the backup directory in your Moodle data folder using FTP. Then use the ‘Restore course’ page to select the file from the server.
  • Increase memory limit: Set memory_limit in php.ini to at least 256M, or higher for large courses.
  • Test with a small backup first: If you’re unsure about settings, try restoring a small course to verify everything works.
  • Keep backups organized: Name your backup files clearly with course name and date to avoid confusion.
  • Use the ‘Async’ restore option: In newer Moodle versions, you can enable asynchronous restore in Site administration → Advanced features. This allows the restore to run in the background, so you can close the browser.

Troubleshooting

  • Upload fails with ‘File exceeds maximum size’: Increase upload_max_filesize and post_max_size in php.ini, then restart Apache/Nginx. Also check the max_file_size setting in Moodle under Site administration → Plugins → File picker.
  • Restore process times out: Increase max_execution_time in php.ini to 3600 or more. Also consider enabling asynchronous restore.
  • Error ‘Cannot read backup file’: The file may be corrupted. Re-download the backup and try again. Ensure the file extension is .mbz.
  • Restore completes but course is empty: Check if the backup included activities. If not, the backup was incomplete. Also check the restore log for errors.
  • Disk space full: Free up space on the server or increase the data directory limit. Temporary files are stored in moodledata/temp.
  • Errors about missing plugins: If the backup was created on a site with additional plugins, you need to install those plugins on the target site before restoring.

Frequently Asked Questions

What is the maximum file size I can upload?

It depends on your PHP settings. By default, Moodle allows up to 100 MB, but you can increase it by editing php.ini. There’s no hard limit in Moodle itself; it’s a server limit.

Can I restore a course backup from a different Moodle version?

Yes, but it’s best to use the same or newer version. Restoring from an older version usually works, but restoring from a newer version may cause compatibility issues. Moodle will warn you if there are problems.

How long does it take to restore a large course?

It varies based on the course size and server performance. A 1 GB course might take 10-30 minutes. Enabling asynchronous restore allows you to close the browser and check later.

Do I need to be an administrator to restore a course?

Yes, the ‘Restore courses’ capability is typically only given to administrators. If you’re not an admin, contact your site administrator to perform the restore.

What if my backup file is larger than 2 GB?

Use FTP to upload it directly to the server’s backup directory. Then, on the Restore course page, select the file from the ‘Server’ section. This bypasses the HTTP upload limit.

Can I restore only part of a course?

Yes, during the restore process, you can choose to include only specific activities, blocks, or files. Uncheck the items you don’t want to restore.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →