Thousands of .mbz files

Thousands of .mbz files

by Albert Ramsbottom -
Number of replies: 14

In our Moodledata/backup/temp folder but we have automated course backups turned off

We also have thousands of log files that have the following output

[Mon Oct 22 14:48:58 2018] [info] instantiating backup controller e55d655018fbbd6f503f438dfc9f5a27

[Mon Oct 22 14:48:58 2018] [debug] setting controller status to 100

[Mon Oct 22 14:48:58 2018] [debug] loading controller plan

[Mon Oct 22 14:48:58 2018] [debug] setting controller status to 300

[Mon Oct 22 14:48:58 2018] [debug] applying plan defaults

[Mon Oct 22 14:48:58 2018] [debug] setting controller status to 400

[Mon Oct 22 14:48:58 2018] [debug] setting file inclusion to 1

[Mon Oct 22 14:48:58 2018] [info] checking plan security

[Mon Oct 22 14:48:58 2018] [debug] setting controller status to 700

[Mon Oct 22 14:48:58 2018] [debug] saving controller to db

[Mon Oct 22 14:48:58 2018] [debug] calculating controller checksum 4a622cfd2784c59c2db2b83f4ff7165a

[Mon Oct 22 14:48:58 2018] [debug] loading controller from db

[Mon Oct 22 14:48:58 2018] [debug] notifying plan about excluded activities by type

[Mon Oct 22 14:48:58 2018] [debug] setting controller status to 800

[Mon Oct 22 14:48:59 2018] [debug] setting controller status to 1000

[Mon Oct 22 14:48:59 2018] [debug] saving controller to db



Any ideas, as we are at a loss as too where these have come from. I would have thought that anything left in the temp folder hasnt completed properly but if we have automated course backups turned off, then what could they be


Cheers


Average of ratings: -
In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Albert Ramsbottom -

This is weird as well


In the log files there is a ../ and a ./

 ../

-rw-rw-rw-  1 www-data www-data 1.1K Oct 22 15:04 6cc77f863ae8fad421b41c8d6f787046.log

drwxr-x---  2 www-data www-data 668K Oct 22 15:04 ./

-rw-rw-rw-  1 www-data www-data 1.1K Oct 22 15:03 20e53536327c80b680a71fff203c2d2f.log

-rw-rw-rw-  1 www-data www-data 1.1K Oct 22 15:01 f97d976f7e3af380b74b66890f8b6e6f.log

-rw-rw-rw-  1 www-data www-data 1.1K Oct 22 15:01 2d5733d9a99b9d090e25960795325f84.log

Cheers

In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Ken Task -
Picture of Particularly helpful Moodlers

Not following ...

you are in moodledata/temp/backup/

./ would be that directory ... ./ present working directory.

../ (two dots) would be one level up ... thus in moodledata/temp/

The files you show do have something in them ... 1.1K?  They are text files.   What's in them?

'spirit of sharing', Ken


In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Ken Task -
Picture of Particularly helpful Moodlers

Teachers have the ability to make backups of their courses, do they not?

The directories, files, logs, etc. in moodledata/temp/backup/ are used in any backup process be that process called by automated backups or by teacher or by an admin of the site.

You might do a query of mdl_files table for .mbz files to see user ids and components ... ie, who done it ... for the back files themselves.

'spirit of sharing', Ken



In reply to Ken Task

Re: Thousands of .mbz files

by Albert Ramsbottom -

Yes that is true but we are getting them 2 every minute and have done for the last 3 days sad

Inside each .log file, which suggests an automatic backup has been running



[Mon Oct 22 15:52:13 2018] [info] instantiating backup controller 81b5b7f1c67fee6ec30b890c281acf8c

[Mon Oct 22 15:52:13 2018] [debug] setting controller status to 100

[Mon Oct 22 15:52:13 2018] [debug] loading controller plan

[Mon Oct 22 15:52:13 2018] [debug] setting controller status to 300

[Mon Oct 22 15:52:13 2018] [debug] applying plan defaults

[Mon Oct 22 15:52:13 2018] [debug] setting controller status to 400

[Mon Oct 22 15:52:13 2018] [debug] setting file inclusion to 1

[Mon Oct 22 15:52:13 2018] [info] checking plan security

[Mon Oct 22 15:52:13 2018] [debug] setting controller status to 700

[Mon Oct 22 15:52:13 2018] [debug] saving controller to db

[Mon Oct 22 15:52:13 2018] [debug] calculating controller checksum 6353a521cc5a5951d7447aa57231f87a

[Mon Oct 22 15:52:13 2018] [debug] loading controller from db

[Mon Oct 22 15:52:13 2018] [debug] notifying plan about excluded activities by type

[Mon Oct 22 15:52:13 2018] [debug] setting controller status to 800

[Mon Oct 22 15:52:14 2018] [debug] setting controller status to 1000

[Mon Oct 22 15:52:14 2018] [debug] saving controller to db


Cheers



In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Jamie Biddulph -

Have you had a look in Backup reports (YourSiteUrl/report/backups/index.php) to see if there is anything logged?

In reply to Jamie Biddulph

Re: Thousands of .mbz files

by Albert Ramsbottom -

Yes but nothing reported as we have the automated backups turned off


Cheers

In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Jamie Biddulph -

It may be worth reviewing the output of the Moodle Cron as this should display any backup attempts and the names of the courses that are being (or attempted to be) backed up.


In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Ken Task -
Picture of Particularly helpful Moodlers

There is a php script in moodlecode/admin/cli/ called 'automated_backups.php'.  Is that being run from a cron job or script outside of Moodle?   Even from another server as of 3.4 crons can be run from another server.

Is this a load balanced setup with nodes that have replicated code and thus each node server could call the scripts in code/admin/cli/?

'spirit of sharing', Ken



In reply to Ken Task

Re: Thousands of .mbz files

by Albert Ramsbottom -

Hi

Yes it is load balanced, so I am going to have a look now for multiple crons. However, I read on these forums that lots of MBZ files in temp/backup could be due to the recycle bin issue. I believe you have been involved in some of these threads

I have also been getting cron errors related to the recycle bin and this issue

Adhoc task failed: core_course\task\course_delete_modules,Coding error detected, it must be fixed by a programmer: The course module 1418453 could not be deleted. #0 /var/www/html/moodle/backup/util/factories/backup_factory.class.php(65):$

#1 /var/www/html/moodle/backup/controller/backup_controller.class.php(109): backup_factory::get_logger_chain(false, 1, 'b6eb5b047736a6a...')

#2 /var/www/html/moodle/admin/tool/recyclebin/classes/course_bin.php(123): backup_controller->__construct('activity', '1418453', 'moodle2', false, 10, '2')

#3 /var/www/html/moodle/admin/tool/recyclebin/lib.php(151): tool_recyclebin\course_bin->store_item(Object(stdClass))

#4 /var/www/html/moodle/course/lib.php(1185): tool_recyclebin_pre_course_module_delete(Object(stdClass))

#5 /var/www/html/moodle/course/classes/task/course_delete_modules.php(66): course_delete_module('1418453')

#6 /var/www/html/moodle/lib/cronlib.php(181): core_course\task\course_delete_modules->execute()

#7 /var/www/html/moodle/lib/cronlib.php(74): cron_run_inner_adhoc_task(Object(core_course\task\course_delete_modules))

#8 /var/www/html/moodle/admin/cli/cron.php(61): cron_run()

#9 {main}

Backtrace:

* line 181 of /lib/cronlib.php: call to core_course\task\course_delete_modules->execute()

* line 74 of /lib/cronlib.php: call to cron_run_inner_adhoc_task()

* line 61 of /admin/cli/cron.php: call to cron_run()

Cheers

In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Albert Ramsbottom -

Been checking my mdl_backup_controllers table as I have been getting .log files in the temp folder with info about backup controllers as well and these suggest backups running

I have 500 controllers listed, are these failures or successful? Should they clear out of the table?


Cheers

In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Albert Ramsbottom -

I have now got 500 or so backup controllers with a status of 700 (unfinished), that ran between Friday and Sunday. It seems that something was stuck in a loop and as we have got automated course backups turned off I think it maybe something to do with the recycle bin

All the backup controller entries have an itemID of 3878176. This I would have thought was something that has been recycled, maybe an activity

How can I find out what this itemID is and what course it lives in??

Cheers

In reply to Albert Ramsbottom

Re: Thousands of .mbz files

by Ken Task -
Picture of Particularly helpful Moodlers

The course re-cycle bin actually uses the backup process to create a small .mbz.

Working on a server right now that has a space issue and in investigating what was taking up an increase in disk usage ran this query ...

select filearea,userid,filename,filesize  from mdl_files where filename like '%.mbz'

example of what you will/should/might see:

recyclebin_coursecat    2    backup.mbz    5835
recyclebin_coursecat    2    backup.mbz    7590
recyclebin_coursecat    2    backup.mbz    165623892
recyclebin_coursecat    2    backup.mbz    5505995
recyclebin_coursecat    2    backup.mbz    5502692
recyclebin_coursecat    2    backup.mbz    5805
recyclebin_coursecat    2    backup.mbz    5673
recyclebin_course    2    backup.mbz    19325907
recyclebin_course    2    backup.mbz    20392869
recyclebin_course    2    backup.mbz    47135526
recyclebin_course    2    backup.mbz    62411002
recyclebin_coursecat    2    backup.mbz    79996

IF one were to find the contenthash of these backup files, locate the real file in the sea of files in moodledata/filedir/, copy that file out to a test directory, then un-compress it, one might see an xml file in the extract that gives hints/clues.

Was just looking at this on server am working with and the item above:

recyclebin_course    2    backup.mbz    62411002

is a total course backup - with a moodle_backup.log and moodle_backup.xml

Wow!  Someone needing an immediate solution to free up space now has a lot more work to do! :\

'spirit of sharing', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Re: Thousands of .mbz files

by Ken Task -
Picture of Particularly helpful Moodlers

Follow up for space crunch ...

There are some settings for recyclebin duration ... https://site/admin/settings.php?section=tool_recyclebin

Default duration is 1 week.   If one needs space ASAP, one could set duration more frequently and then run the task for emptying recyclebin via task - run now - or via running the CLI version of those task.

Wonder if that really sends files to trashdir ... guess I'll have to experiment and see. :\

'spirit of follow up', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Thousands of .mbz files

by Josiah Pease -

You can query the DB :


function mmm { sudo -u apache rm sitedata/filedir/${1:0:2}/${1:2:2}/$1 ; }

mysql moodle <<< "select contenthash,filename from mdl_files where mimetype = 'application/vnd.moodle.backup' and filearea = 'recyclebin_course'" | while read line ; do mmm $line ; done


but these things are probably best done via moodle