How to restore large course backup of moodle 2.1 in to new course

Re: How to restore large course backup of moodle 2.1 in to new course

by Pedro Fernández -
Number of replies: 0

Hi,

I know it is a bit late for a reponse, but it may be useful for anyone having the same problem. This aproach does not require any plugin and it also works in Moodle 3. You just need an FTP client, access to your database, and a little hack acting on the repository. Here are the steps I followed:

  1. Enter Moodle and create a new empty course called "Test" or anything you want
  2. Make a backup of that empty course and name the file "test.mbz" in the 3rd step
  3. Find the backup file in the files repository (these steps can be used to find any file in the repository):
    1. Enter your database and open the table mdl_files. Search for "test.mbz" in the filename column
    2. Note down the corresponding contenthash value. In my case it was c2b0ddc996be73daf2ca8a39ea8386a92b6a6aa5
    3. The file will be located in /moodledata/filedir/HASH1/HASH2/, where HASH1 are the two first characters of the hash, and HASH2 the 3rd and 4th characters.
    4. Open your FTP client and navigate to that location. In my case /moodledata/filedir/c2/b0/. Remember that in your case the names of the two last folders may be different. There you will find a file which name is the contenthash code. This file is the backup file you have just created
  4. Rename the file to add the extension .bak. For example, from c2b0ddc996be73daf2ca8a39ea8386a92b6a6aa5 to c2b0ddc996be73daf2ca8a39ea8386a92b6a6aa5.bak
  5. Upload the backup file of the course you really want to import to the same folder
  6. Rename your backup file to the previous hash value
  7. Go back to Moodle and restore your "test.mbz" course into a new course. This way the system will use the uploaded file instead of the real test backup. If everything is ok you will have correctly imported your old course.
  8. Turn to the FTP client, remove your backup and rename the .bak file to remove the extension. This step is not mandatory, but it is useful to keep the files repository in a consistent state.
  9. Finally, you can remove the "Test" course and its backup or keep them for future imports.

Kind regards.


Average of ratings: Useful (3)