Cleaning up Disk Usage MDL-71909

Cleaning up Disk Usage MDL-71909

by Jon-Erik Lido -
Number of replies: 9
Hi folks,

I recently learned my Moodle instance (3.11.9+ (Build: 20220826)) was gobbling up free storage and completely filled a 70GB partition. Searching the forums I learned of the MDL-71909 bug. I have since run the delete_unused_files.php script, which deleted about 4000 files. However, it only freed up about 1 GB. I ran the script a second time and it says 0 files deleted, so apparently that's all it can find.

As the Course Size report is showing many courses inexplicably the 2 to 10 GB range. There's no reason those courses should be that big.

I don't know how to proceed. I want to make sure all of the bad data is removed before I upgrade to the latest Moodle release on a new server. Can someone provide some guidance please?
Average of ratings: -
In reply to Jon-Erik Lido

Re: Cleaning up Disk Usage MDL-71909

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
MDL-71909? Have fun! I don't know how many days and nights I spent on it, just for the post-mortem. Firstly, the patch was available since 4.1 only, although the regression was somewhere in 3.7. I was told that back-porting it to 3.x was simple. Secondly the patch didn't clean the mess. It was left to home brew like what Leon Stringer made. By that time the administrators of the site have given up.

Sorry for being not helpful. But the tracker issue has details of both for DIY.

In reply to Visvanath Ratnaweera

Re: Cleaning up Disk Usage MDL-71909

by Jon-Erik Lido -
I'm curious if a possible partial workaround is to backup old courses to external storage, and then remove them. Will that free up the assignments associated with those courses that are currently floating around in limbo?
In reply to Jon-Erik Lido

Re: Cleaning up Disk Usage MDL-71909

by Ken Task -
Picture of Particularly helpful Moodlers
"partial workaround is to backup old courses to external storage"

You have to have enough space to build the backups on your server and have command line access to run the CLI backup script in admin/cli/ to point the place to save the backup OFF your server - a mount point for an external data device (or similar).

Where you host, does hosting offer attached data devices?

'SoS', Ken

In reply to Ken Task

Re: Cleaning up Disk Usage MDL-71909

by Jon-Erik Lido -
Yes, that makes sense. I have a few gigabytes to work with now, which might be sufficient. If not, I will mount some external storage using rclone or NFS. But theoretically, the process of deleting a course should delete these zombie files?

Also, are there any temp directories Moodle uses that I need to make sure have sufficient space, or is it just the export destination I have to worry about?
In reply to Jon-Erik Lido

Re: Cleaning up Disk Usage MDL-71909

by Ken Task -
Picture of Particularly helpful Moodlers
'a few gigabytes' ... that means 10 or under?  Sufficient ... remains to be seen.

df -h

moodledata/temp/backup/ is the build area moodle uses to create .mbz (backup) files.

zombie files ... there is a command line only utility for moodle called 'moosh'.   It has some file commands that might help.

https://moodle.org/plugins/view.php?id=522
https://moosh-online.com/commands/
 
'SoS', Ken

In reply to Jon-Erik Lido

Re: Cleaning up Disk Usage MDL-71909

by Brett Dalton -
Picture of Moodle HQ Picture of Particularly helpful Moodlers
Are students submitting video files or are there any use of video in content?  that will eat space very fast.
In reply to Brett Dalton

Re: Cleaning up Disk Usage MDL-71909

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
MDL-71909 didn't bite you? Call yourself lucky! It was not about genuine uploads, it was a time bomb; PDFs started multiplying in size, taking their time since Moodle 3.7. When people ran out of space, most of them were in 3.9-3.11. One of the effected sites I was called to investigate exploded. The administrators gave up the whole site.
sad

I'm serious: Somebody needs to do a research to find out the percentage of bloat in world-wide Moodle repositories (moodledata/filedir/) caused by MDL-71909.
In reply to Visvanath Ratnaweera

Ri: Re: Cleaning up Disk Usage MDL-71909

by Sergio Rabellino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I read the MDL-71909 but there is a thing about it: the files tied to a not- enabled editpdf_feedback activity, could be directly removed without affecting the assign itself ? Are only copies of unconverted items ? It's safe to mix-and-use/arrange the proposed scripts to catch and delete these orpnahed files ?
This was unclear to me.
In reply to Sergio Rabellino

Re: Ri: Re: Cleaning up Disk Usage MDL-71909

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
When I got "clarity" it was too late for half of my people. The other half still runs Moodle carrying bloated moodledata/filedir/, simply because they have enough resources (disk space).

Too painful to repeat those details. I know, MDL-71909 itself is long enough, then there are the linked discussions which dissected it centimeter-by-centimeter.