Backup doesn't appear for restore

Backup doesn't appear for restore

hamza khalem發表於
Number of replies: 10

I am using moodle with version 4.0

the backup of courses works fine with satuts of 'OK'

but when i go to restore page it doesn't appear in the automated backup section.


what could be the problem?



評比平均分數: -
In reply to hamza khalem

Re: Backup doesn't appear for restore

Ken Task發表於
Particularly helpful Moodlers的相片
In the setup of automated backups, there is an option as to where to save the backup ... one of those is a designated directory outside of moodledata.

'SoS', Ken

In reply to Ken Task

Re: Backup doesn't appear for restore

hamza khalem發表於
well thank you .
but why they don't appear, and where to find them in moodledata ? ..


In reply to hamza khalem

Re: Backup doesn't appear for restore

Ken Task發表於
Particularly helpful Moodlers的相片
"why they don't appear"
Bug? (maybe) ...  or it was thought that in the context of System Admin, not desired for teachers to see the backups of other courses.

"and where to find them in moodledata"
If you have setup a designated directory outside of moodledata and autobackup set to save there only, they are not in moodledata.   Thus, one won't find them in moodledata.

Case where that's handy .... on a typical Linux server moodledata 'normally' in /var/www/ and main device/drive has only 30Gig - enough space to run a small moodle.  But one has some massive storage device attached ... like a Google Bucket.

'SoS', Ken


In reply to Ken Task

Re: Backup doesn't appear for restore

hamza khalem發表於
Thank you Ken ,

Still I don't get where exactly to find them (I am system admin), I didn't set up a designated directory they should be stored in moodledata where I couldn't find really.

I will try to debug, and check if there's a bug in the process .

Thank you again :D

Hamid.
In reply to hamza khalem

Re: Backup doesn't appear for restore

Ken Task發表於
Particularly helpful Moodlers的相片
With no designated directory and not using anything but defaults in moodle, backups go to moodledata/filedir/

Structure of moodledata/filedir/
Using a tool to browse files (moodle doesn't have such a tool) navigate to your moodledata/filedir/   First thing you need to do is read the 'warning.txt' file you will find there.

In filedir you will see a bunch of directories with 2 character/number names .. like 01 fg, ab, 02, 34, etc.

Inside each of those subdirectories, files whose name actually come from the DB (mdl_files table / contenthash column).

So a backup .mbz file might reside in:
moodledata/filedir/01/zz/ and it's name might be
01zzabunchofnumbersalphanumericcharacters.

The are of mimetype gzip (gunzip).

Without a plugin for backups the only way admins/teachers/manager see them is to visit a course and 'pretend' to restore.


If you install it, make sure you get the one compatible with your core moodle.

To see if you can find them another way .. use the mysql client on your server.   Command line.  Once connected via the client to your DB server and using the DB for Moodle (seen in config.php of your site), one can run this query:

select contenthash,component, filename,filesize from mdl_files where filename like '%.mbz';

If you don't have command line access, use whatever tool you have to work with the DB - in many hosting provider setups, that's phpmyadmin.

You've not mentioned how and where you are hosted.  If on shared hosting, there could be caps/limitations that are the cause of the issue.

You might also review:

'SoS', Ken

In reply to Ken Task

Re: Backup doesn't appear for restore

Rizal Masandiansyah發表於
Hello Ken task, so you mean if the place where the automatic backup is stored is outside the moodle then it can't be seen in the Automated backups area?
please advise
In reply to Rizal Masandiansyah

Re: Backup doesn't appear for restore

Ken Task發表於
Particularly helpful Moodlers的相片
Confusing isn't it!

Yes.   Auto backups sent only to a designated directory would not be seen by teacher pretending to restore a course.

Unless, you used a linux trick ... in moodledata/repository (where you setup file system repos) ... a linux symlink that points to the designated directory outside of moodledata/filedir/

That used to work great for a Google Bucket ... seen only by the System Admin in a hidden System admin only course using file system repo ... but read on....

However, in recent versions of Moodle 4.0,4.1.42, and probably beyond it appears the best option would be to install the allbackups plugin I mentioned in earlier post.

So now an attached storage device (not a Google Bucket) is the only thing that can be symlinked ... moodle security is probably the reason.

I'll be so bold as to say I wouldn't host anywhere that didn;t offer attached data devices - given that used moodles only grow, they do no shrink.

One thing for certain ... change ... it seems now the System Admin person and true server admin's need to be on the same page for when things change in moodle, those 2 persons might need to become more imaginative than before to get desired setup.

My 2 cents!
'SoS', Ken

評比平均分數:Useful (1)
In reply to Ken Task

Re: Backup doesn't appear for restore

Alan Z發表於
Hi Ken,

I'm hosting Moodle 4.2.1 on a linux server, and the automated backup is enabled with "Automated backup storage“ being "Course backup filearea". The "Last execution log" shows OK or skipped for the courses and I couldn't find any backup files under "Automated backups" section in the page of restoring a course. I installed the plugin report-allbackup but still I can only find the manual backups there. 

What should I do to make the backups visible in report-allbackup?

Thank you so much for your help in advance.
In reply to Alan Z

Re: Backup doesn't appear for restore

Ken Task發表於
Particularly helpful Moodlers的相片
Have a 4.2.6+ sandbox server on Linux.

Unfortunately, All Backups plugin shows compatibility up to 4.1
https://moodle.org/plugins/report_allbackups/versions

However, it did install in my 4.2.6+ without complaints.
This to say, am gonna assume it will work.

I have had auto backups turned on in my sandbox.   Am doing that
now to see what the plugin will show.

As usual, with many things moodle, one cannot find everything one needs in one place.
And, having command line access to the site is a very big advantage.

From what you have described your settings for auto backups will save the backups
made to the sea of files in moodledata/filedir/ and those file names are not humanly
recognizable.
One can see that via a query of the mdl_files table:
From mysql client prompt or from phpmyadmin, run the following queryY

mysql> select contenthash,component,filearea,filename,filesize from mdl_files where filename like'%.mbz';

In display of what is found, the filearea column should have 'automated' and looks
like (yours won't have same course names):

| 46748d35203c71b26e1a6938f70349c8b53324b9 | backup       | automated | backup-moodle2-course-6-ktnoclas2-20240402-0625.mbz    | 33681272 |
| 1fe426a26c6ad652540bf78e30470891eaea8ea4 | backup       | automated | backup-moodle2-course-1-mdl42sb-20240402-0625.mbz      |     3978 |
| aa3732b1be3ec66fee3985cf1d9accb54ef180e7 | backup       | automated | backup-moodle2-course-2-ktnoclas-20240402-0625.mbz     | 33681466 |
| 172d08ff3a45dc95677c1343b78b87ab4bc53944 | backup       | automated | backup-moodle2-course-9-mdlsampler-20240402-0625.mbz   | 67305145 |

and when looking at course reuse restore for mdlsampler course, I do see a backup I could
restore.

See screen shot.

All I can tell you at this point is to review all the settings for Autobackup.

'SoS', Ken


附件 autobackuprestore.png
In reply to hamza khalem

Re: Backup doesn't appear for restore

Mary Cooch發表於
Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Testers的相片 Translators的相片
Just double checking when you say "the backup of courses works fine" you are talking about automated backups and not course backups that you manually do yourself from within a course?