I have an automated backup of a class in Moodle 1.9. The size is 83 mb. I have tried repeatedly to restore this class using the information from these forums to no avail. Now, I would simply like to extract this file on my computer to recover some important files from it. Is there a way to extract .mbz files? I've already tried on a Macbook pro at I am receiving error message, "unable to expand course-20110904-0000.mbz into desktop. No such file or directory".

thanks for this info on reading the mbz files. I converted them to zip and was able to extract them. The files.xml opened up in my Dreamweaver program and I am able to see the content hash. However, I'm lost when you state to decript the hash. I understand the term, but don't know how to actually do it. Would you have time to expound on that step?

BTW, I'm simply wanting to get the text from each course, which was built from some Word docs, but the course content changed here and there once they were in the moodle, so I thought it would be easier to upload the course files and get the newest version of the course content (text) this way. Our goal is to update the word docs so we have the course content (text) easily available for other uses down the road.

Certain .xml files must be at the root of the zipped file ... such that, when un-zipped, they are found.

So, if you created a 'test' directory and extracted the .mbz in there, edited, and that's where the .xml files reside, one must recreate the zip from the contents of the test directory ... not the test directory itself.

Above you show 'moodle_backup_xml' ... isn't that supposed to be 'moodle_backup.xml' - ie, a file not a folder?

Once again ... moodle_backup_xml indicates a folder. What you edited was moodle_backup.xml (see the 'dot' and xml extension?)

Once you have edited the moodle_backup.xml file making sure you've not inadvertently edited in-correctly ... leaving a start xml tag or and end xml tag with no corresponding start/end, then we re-zip the extracted *contents* of the test directory.

**In the test directory**, issue:

zip -r abackup.zip *

Must use -r (recursive) or zip won't create all the folders/files contained in the test directory.

That will complain about 'abackup.zip'. That's ok. Let it! ;)

Then rename the abackup.zip to abackup.mbz

mv abackup.zip abackup.mbz

The name of the file doesn't make a diff to Moodle. It just looks at the filename extension (.zip/.mbz).

Am unaware of any program that does this, but it would make a handy utility to run on a server! A .mbz file is a zip by another extension and used only for Moodle. It's like a .docx ... it's a zip too!

Hmmmm ... got this via Moodle IM also ... to which I replied ... but will also here in case am in-correct (then others can correct the advice):

Operating systems have a temp directory. Moodle wants it's own.
Look in your data folder for moodle (moodledata?). There should be a 'temp' folder
there.
Contained therein is usually a 'backup' folder which is used by Moodle during backup
and restore processes. It's the location where moodle builds the xml files and folders for
a course to create backups (.mbz's) and/or restore courses from backups.
If they don't exist, something happened with the install. You've not mentioned what
operating system, nor any other what might be important information, so the
following is for Linux:
cd /var/www/moodledata
ls
should see a 'temp' folder there.
If not make one: mkdir temp and set ownership/permissions for apache:
chown apache:apache temp -R
Also, the phpinfo resource from the Site Admin menu will show settings for php ...
which does include a temp setting. That really doesn't need to be changed as Moodle looks
for it's temp folder first.
Again ... if the directory is not there, it could be an indication that your
installation failed or hickup'd for some reason. You might discover other things.
BTW, when Moodle 2 sees a .zip file during a restore process it will warn it's not a
'valid' backup file and will attempt to convert it to an .mbz. Rename your backup
files and use .mbz extensions if the backups were created with a Moodle 2.
Ken

I've tried this strategy and it did not work. When I rename the file as a .zip file and open it, it turns out that the zipfile contains a huge file that is bigger than the zipfile and obviously was compressed into the zipfile. This file has the same name of the .mbz file and has not any extension.

So I did a few educated guesses and renamed the file as a .tar file and ... it worked: opening the tarfile I was able to extracte the contents. The Moodle version we are using here seems to first pack everything into a tarfile and then to zip it.

So, the procedure is as follows:

1. Rename the .mbz as a .zip file

2. Unizp it

3. Rename the resulting extensionless file as a .tar file

4. Untar it

If you are using Windows, you can open a tarfile with most compressers/uncompressers. If you are using WinRAR you will be able to perfom both operations with the same programa, just opening the file twice: once to unzip and once to unrar.

I did not try to rename the .mbz as a .tgz file and tried to gunzip it at once in Linux. Maybe that works also.

One of the things to look for in forums is date of the thread. The first posting in this thread was back in 2011. Some information provided in this thread applied back then. However, Moodle has moved forward and changes were made so some postings may not apply now. Around version 2.6 an 'experimental' compression showed up ... a .mbz (which used to mean 'moodle backup zip') was no longer accurate IF one turned on and used the 'experimental' tar.gz compression. Moodle's extension for a backup did not change.

Fast forward to version 2.9 .... the latest and greatest as of the date of this posting. The default compression is now tar.gz. Extension to backups are still .mbz, however.

Changing file name extensions, BTW, is a step primarily for users who use systems that rely upon those three letter extensions to determine what applications are associated when one clicks/double-clicks on them. On Linux (MacOSX), if one were to know the file stored in filedir/x/y/[bunch of letters numbers] was a tar.gz, one doesn't need to change the filename to include an extension to be able to use tar zxvf [longfilename].

It should be noted, somewhere, that one may not remember what compression routine was in use when a backup was made and before one attempts unzip/tar zxvf an inspection of the file properties itself would help to know. A file -b [file].mbz, however, will report it's a Zip and one must have version 2 to unzip on a Mac - even though it's a tar.gz. When trying unzip on a .mbz that is a tar.gz it will error out. When that happens, try the other! ;)