Massive Orphaned Files

Massive Orphaned Files

by James Snell -
Number of replies: 3

Hi,

Using the Course File Usage Report, I've found two courses that are using 50GB of storage, for which I'm sure their actual file assets probably total well under 500MB.

Here's a screenshot:



The second listed course, I used the cli tools to make a backup of. I restored it and found the course was using about 150MB. I then deleted the original. However, the overall size of my filedir has not gone down by nearly that much, rather, only about 8GB. 

This Moodle server started life many years ago on an early version of 2.x and I've gradually updated it the whole time. I suspect I've got orphaned files not being used by anything now. 

How can I verify that my filedir only contains files with actual references to them? I've used the "File Trash" plugin, but it only found about 3GB of stuff. 

Please help.

Average of ratings: -
In reply to James Snell

Re: Massive Orphaned Files

by Ken Task -
Picture of Particularly helpful Moodlers

Advise installing moosh ... http://moosh-online.com/

A couple of it's commands:

http://moosh-online.com/commands/

deal with missing files, orphaned files, etc..

file-datacheck, file-dbcheck, file-list

Do you hide courses?   Are students (and their submitted assignments) still in those hidden courses?   Did the teacher of that course make any backups of that course (or do Teachers make any backups at all?).   Those backups are in Teachers 'private files' and you, as an admin level user, even if you visit the course, won't see those Teacher private files' backups.

Funny you should post this today of all days .... just spent 8 hours today on a site that's pretty much been neglected for about 2 years now.   2TB data drive had reached 90%+ with some courses over 130Gig.

What a mess! :\   About 500 courses have to be inspected.

Moosh has been a handy/helpful tool.

'spirit of sharing', Ken

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

Re: Massive Orphaned Files

by Bret Miller -
Picture of Particularly helpful Moodlers
Thanks for this, Ken. I always suspected there were tons of orphaned files in my moodledata, but now I know there's not--or at least that most are in the database. I'd never really looked at moosh before even though I use drush and wp-cli. 
In reply to Ken Task

Re: Massive Orphaned Files

by James Snell -

Thanks Ken, that sounds like the road to a solution for me. I'll check it out in detail.