When I browse to the course that I have backed up, and click restore, i see the backupfile area for that course. Right clicking the download link brings up a save as dialog that allows me to *copy the .mbz file to another server.
This works great EXCEPT WHEN THE .mbz file that is bigger than 100 MB. If the file is larger than 100 MB (and believe me, I have made all the adjustments to the php.ini file) the browser crashes and does not allow me to move or copy the backup file. I am dead in the water. And since moodle 2.x hides files so well, its very difficult to find the actual .mbz file in the file system so you can copy it using the OS.
Today, I found this amazing post that detailed how to FIND THE .MBZ file in your filesystem.
The highlights are this:
- Open the db and browse to the mdl_files table
- Find the name of the backup file in the mdl_files table in your DB. Look in the filename field
- I filtered by filearea = 'backup' - reduced my file list from 70000 to 150.
- Find and copy the hashed name in the contenthash field.
- Browse to the server where your datafiles are stored (if not sure, look in the config.php file) - they will not be inside the webroot of the site. I keep mine on a different drive, the F drive.
- Look for the moodledata\filedir (this is the secret location)
- Now search for the contenthash field value - that big long string.... there is a file hiding somewhere in the moodledata\filedir filesystem. FIND IT.
Mine was in two folders down like moodledata\filedir\xx\xx.
8. Once you find it, you can copy it.
I copied mine to the server where I would be restoring and renamed it
9. Now you are ready to restore the file!
Wow, it restored the first time 100% correctly.
Moral of the story?
You can find and copy and rename and restore a *hidden backupfile with a little perseverance.Use the forums, sometimes people are golden!
I tried this technique again today and could not find the hash file name anywhere in the filedir. frustrating. I tried creating the backup file a couple times. I could find the file in the moodle mdl_files table, copied the hash name and searched....I was able to find it by browsing the moodledata directory and using the Date Modified column to filter down to folders with the current time stamp, and then found the file.
ReplyDeleteWorked like a charm for me, a few details:
ReplyDelete# sql script to find the exactly filename you created in the backup
SELECT filename, contenthash FROM mdl_files where filename=‘backupfile.mbz’;
#command to find the file in linux:
find /moodledata/filedir/ -type f -name “contenthash”
after found, copy it renaming to .mbz:
cp /folder/contenthash /folderdestiny/backupname.mbz
BR
This comment has been removed by the author.
ReplyDelete