moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Chad Outten -
Number of replies: 11
Picture of Testers

G'day Moodlers!

We've noticed course data has bloated a lot with the recent upgrade to 2.0. Have gone through and deleted unnecessary legacy course files and backups. However, this does not seem to reduce our disk usage - why not?!

Can someone pls confirm it is safe to the delete contents of moodledata/temp and moodledata/trashdir for 2.0.

Cheers, Chad

Average of ratings: -
In reply to Chad Outten

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Manish Verma -

I have noticed similar issue even after running several cron cycles.

Manish.

In reply to Manish Verma

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Manish Verma -

After 24 hours, cron does seem to clean up a few extra things and size reduction is noticed. A few lines from cron report are as follows:

Cleaning up files from deleted contexts... done.
Deleting trash files... done.

I read somewhere in tracker that some cleaning is done after 4 days as well.....

Manish.

In reply to Chad Outten

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Melinda Kraft -

See this post about the 4 day hold on trash: http://moodle.org/mod/forum/discuss.php?d=191275

We are having the same problem as described here and above. We'd been tweaking the automated backup code to fix the file naming back to the way it was in 1.9 (keeping the shortname in the file name). As a consequence of the hacking/tweaking, we've enabled and disabled automated backups several times for testing. Collectively our semester backups are about 25GB, so during this testing phase the trashdir folder has expanded significanly from the discarded automated backup files (see forum link above - we keep only 1 copy).

I'm not ready to tweak the db table just yet (as suggested in the post above) because I hate hacking the core or the tables.  On a side note, there's also 6gb of stuff in the moodledata/temp/backup folder. I suspect this is how moodle processes "unifinished" backups, so more research is definitely in order. 

While it was relatively easy to calculate file space needs in Moodle 1.9 based on your knowledge of site usage, I'm realizing that in Moodle 2+ you really need to plan to have a heck of a lot more available storage for the moodledata folder to accomodate the new file management system. I just wish where was a way to calculate just how much space that should be!

In reply to Melinda Kraft

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by SVI eSolutions -

I have a question along the same lines...

Does anyone know if the Moodledata/temps/filestorage ever get empties by the cron?

In reply to SVI eSolutions

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Ken Task -
Picture of Particularly helpful Moodlers

Yes.  running the cron will delete references in moodledata/trashdir ... eventually.  System has to see that NO links exist to the files in question in any course/context.  It then moves those references in the DB and the associated hashed directories into trashdir.

So if there is a hidden course ... not being used ... those are counted as valid and thus the files associated with that course are never moved to trashdir.

As far as calculating size/space needed ... think it's more important now to pay attention to the partition upon which the DB files reside.  Had an interesting issue not long back ... entity had RHE server with a Terabyte /data partition ... that's where the data folders for versions 1.9.x of Moodle resided.  When entity decided to run 2's in parallel with the 1.9's (just in case), experienced issues with the 2's ... reason ... whomever did partitioning partitioned /var ... where the DB files reside for MySQL.  When that partition reached max, apache up, moodle 2's were accessible (one could login because session information wasn't recorded to DB but a file), but there after ... nothing ... nada.  Had move the DB files to /data and had to change the config of MySQL just so mysqld could launch and backups (sql dumps could be made) run.  Solution eventually lead to installing yet another virtual instance of RHE in a virtual ... this time without partitioning ... moving the Moodles to the new virtual, etc.

So 2 does require 'different thinking'. ;)

'spirit of sharing', Ken

In reply to Chad Outten

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Mike Flender -

Chad, Did you ever get an answer to your original question or figure it out on your own? I'm curious if manually emptying the contents from moodledata/trashdir is safe or if it causes DB problems? Thanks.

In reply to Chad Outten

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Mike Flender -

Chad, Did you ever get an answer to your original question or figure it out on your own? I'm curious if manually emptying the contents from moodledata/trashdir is safe or if it causes DB problems? Thanks.

In reply to Chad Outten

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Mike Flender -

Chad, Did you ever get an answer to your original question or figure it out on your own? I'm curious if manually emptying the contents from moodledata/trashdir is safe or if it causes DB problems? Thanks.

In reply to Mike Flender

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Guillermo Madero -

Hi Mike,

You shouldn't have any problems deleting files from the the trashdir directory.

In reply to Guillermo Madero

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Mauro Mazzerioli -

I had the "Session expired" issue and I fixed it just deleting the trashdir directory contents inside the moodledata directory.

moodledata contents:

cache/
filedir/
.htaccess
localcache/
muc/
sessions/
temp/
trashdir/

remove all content in trashdir directory:

$ rm -rf ~/moodledata/trashdir/*

The issue is fixed.

Also, is it safe to delete the contents of other directories such as

cache/,

localcache/,

sessions/ and

temp/ ?

 

Average of ratings: Useful (2)
In reply to Mauro Mazzerioli

Re: moodledata/temp and moodledata/trashdir - ok to delete contents for 2.0?

by Ryan-Neal Mes -

According to this post you can delete the sessions folder. I think all it will do is clear all existing sessions that are in the sessions folder.

https://docs.moodle.org/24/en/Sessions_FAQ#Do_I_need_to_include_them_in_my_site_backups.3F

The last point explains.


Still investigating cache/localcache and temp