Moodledata Size

Moodledata Size

by William Wallace -
Number of replies: 13

I'm running a 2.7.3+ moodle server and the moodledata folder size has jumped up to 71 GB of data. I checked a previous backup and the folder is only 2.2 GB there. Does anyone have an idea of why it would get so large?

Average of ratings: -
In reply to William Wallace

Re: Moodledata Size

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you set up automated course backups? It can generate a massive amount of data. Especially if you're keeping a lot of copies for each course.

In reply to Howard Miller

Re: Moodledata Size

by William Wallace -

It does do automated course backups, but I was under the impression that it deleted the older files as the new files were created. Is that not the case?

In reply to William Wallace

Re: Moodledata Size

by Robert Brenstein -
Browse the folders on the server and see what there is...
In reply to Robert Brenstein

Re: Moodledata Size

by William Wallace -

It appears to be the filedir folder inside the moodledata area that is taking up all the space.

In reply to William Wallace

Re: Moodledata Size

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It depends what you have got the 'Keep' option set to. If set to 'All' then you will quickly burn up disk space (on a site of any size)

In reply to Howard Miller

Re: Moodledata Size

by William Wallace -

I just checked. It was set to 2. I've lowered it to one to see if that reduces the size next backup cycle.

In reply to Howard Miller

Re: Moodledata Size

by William Wallace -

With regard to the Moodle backup size. I tried assigning the archive to a new folder on the hard drive to see exactly how much space it was using. When the system ran the backup I found that the archived courses only make up 1.45 GB of the data. That leaves nearly 70 GB of unknown data in the moodledata folder.

In reply to William Wallace

Re: Moodledata Size

by Frankie Kam -
Picture of Plugin developers

Hi William

I too am trying to figure out what is consuming so much harddisk space inside my Moodledata folder. Did you figure out where the "nearly 70 GB of unknown data"in the moodledata folder" was coming from?

Regards
Frankie Kam 

In reply to Frankie Kam

Re: Moodledata Size

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Are videos in your Moodle?  How many courses and students are in your moodle, Frankie?

In reply to Frankie Kam

Re: Moodledata Size

by Ken Task -
Picture of Particularly helpful Moodlers

Moodle Admin UI doesn't have any admin level tool to get a total picture of what's contained in moodledata/filedir.  Besides, what you see in the Moodle Admin UI for stuff like 'restore' in a course is really meta data ... info coming from the database.   Taking Automated backups as an example of what could be up space.   There is no course admin nor Moodle Admin tool from site admin, that will show just how many automated backups exist in all your courses.    In order to see, one must go into a course, click restore (not really going to restore) to see if there are files in the 'automated backups' area of the restore process.    If there were 20 in there .. there's a big chunk of the extra space.   Don't need to keep 20 do you?

Right click on one, in the context menu that pops up, delete, repeat until there is only ONE (the most recent).   The save management of that area.

What transpires at that point ....

DB query is made to find the backup file as it is named (contenthash of the mdl_files table) in moodledata/filedir, move the file from it's location in moodledata/filedir/ to moodledata/trashdir.   That still hasn't reduced space.   There is no Admin level tool to empty the trash.   But, there is, as I shared on another posting where you asked a similar question, one could use the built in CLI 'task' for deleting the trash (which would finally remove the files physically from trashdir and FINALLY recover some space.

OR, if you couldn't wait for 4 days for the cron job to run and didn't want to do the CLI task command, use whatever you have to browse files on the system and delete the contents of moodledata/trashdir/

Here's a query to run from the command line to find all backup files ... files that end with .mbz so you can see the contenthash assoiciated.

mysql -u [user -p[password] -e "use [dbname];select contenthash,filearea,filesize,filename from mdl_files where filename like '%.mbz%';" > backups.txt;cat backups.txt

This dumps the query to a backups.txt file and then shows the backups.txt file that query created.

Clip of what could be a large txt file - just one course whose automated backup is large:

ef6fea4983af8d0649be09b6a9ecc5f04fb216d7    automated    358748030    backup-moodle2-course-1468-sppt_7280_sep_2016_mar_2017-20160913-0012.mbz

To use that info ...

Go to Moodle /course/

Search for sppt_7280_sep_2016

Go into course, restore, manage automated backups ... remove the automated backup, save management of that area.

Then the business about emptying the trash.

Eventually that will recover 358748030 of space ... with is approximately: 358M

Have hidden courses no longer being used but in the options for automated backups you didn't tell it to skip hidden courses?

What of the setting for how long to keep logs?   Forever?  A month?   What of the settings in backups for the keeping of loga?

Like Rick mentioned ... got videos in Moodle .. uploaded to Moodle?   Is that course now hidden and no longer users?   Those videos uploaded will remain in the sea of moodledata/filedir cause there is a link to them - active course or not.   Got a course that used to have links to videos uploaded to Moodle, but now you've changed your process and are using a video service/dropbox/google, etc..  Did you remove the old link that pointed to the uploaded video file or did you hide it?    Remove the link no longer using in the active course.   No link, Moodle eventually figures out, oh, don't need this file -> trashdir -> 4days later, gone.

So there's all sorts of places to seek  the files that are the largest and taking up space that you might be able to delete.

Unfortnately, no admin tool to do it ... combo of command line and what can see in the restore process for backups, combo of command line query, edit course in the GUI.  Guess you could install cutomizable reports an gen a list that way.

Each moodle site would be unique and different.

'spirit of sharing', Ken


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

Re: Moodledata Size

by Frankie Kam -
Picture of Plugin developers

Hi Ken and Rick. Thanks for your replies. I'll see what I can do with the information and prompts you guys have shared.

Regards
Frankie Kam