It is to be assumed that these ridiculously large and other courses have multiplied themselves as backups, automated and manual, and bloated moodledata/filedir/. Did you have a formula for tracing them in the backend and deleting safely? Finding them in the web GUI is a nightmare.
Actually, finding/deleting is equally a nightmare via command line! :\
But ... since you asked ... ;) Warning ... do not copy and past below and expect it to work on your server. Change appropriate values for your system. Also note some lines below wrap ... all should go on one line via MySQL > prompt or ssh shell prompt.
select id,filename,filesize,contenthash from mdl_files where filename like '%.mbz'
will display a listing of .mbz files from DB ... looks like:
3317 backup-moodle2-course-136-mdlsampler-20190910-0027.mbz 40937386 7076296142de12818f4b55e692dbb8a32452b319
Last column is the contenthash.
Use the contenthash value to find the file in moodledata/filedir via the following
As per example: 7076296142de12818f4b55e692dbb8a32452b319
find ./ -name 7076296142de12818f4b55e692dbb8a32452b319
If filedir is large command above might take quite a bit of time to complete.
*IF* if finds the file, out put of above will show (as per example):
[root@sos filedir]# find ./ -name 7076296142de12818f4b55e692dbb8a32452b319
note in above example the file is in ./70/76/ subdirs and named
To see if it might be a .mbz backup, issue:
[root@sos filedir]# file -b ./70/76/7076296142de12818f4b55e692dbb8a32452b319
response should be:
gzip compressed data, from Unix
One can then copy out that file to some other location and change it's name
to something more humanly understandable:
[root@sos filedir]# cp ./70/76/7076296142de12818f4b55e692dbb8a32452b319 /var/www/unirepo/somebackup.mbz
ls -l /var/www/unirepo/somebackup.mbz
*** One should now remove the reference in mdl_files table.
*** and then manually remove the file in moodledata/filedir/
*** if it's a matter of space and errant backups that failed for some reason and didn't get cleaned up by cron job, one can manually/safely remove anything in moodledata/temp/backup/
Example: from /var/www/moodle37data/temp/backup
rm -fR * as root