Dear Moodle community,
The server disk today is increasing extremely but I don't know the reason.
Is there any way to know which user who had uploaded individual files? or teachers had uploaded files to his course.
Huy
If sudden, then am not at all sure it's related to Moodle alone and if Teachers have not had a history of certain behaviors (like religiously backing up their course after some major assignment due date) then you might be looking at other things filling up space.
To inspect Moodle .... since that's where you suspect ... an understanding of how the Moodle file system works. It's a combination of meta data from the database and the hashed filenames in /moodledata/filedir/
So, to find where backup files might be in the sea of files in moodledata/filedir/ one needs to begin with a DB query. Below for MySQL:
select contenthash,filename,filesize from `mdl_files` where (`filearea` like "backup" and `filename` like "%.mbz%")
contenthash column will show the location of the file in moodledata/filedir/xx/xx/contenthashname
Here's a real example of output:
9399b6014a19dd0f25112d02ee29f6ae8fe0d952 | backup-moodle2-course-242-pre-ap_wg-20160527-1018-nu.mbz | 9238419243 |
Content Hash is the location of the file and it's filename (in Moodleese). Second column above the humanly recognizable name of the file and last meta data file size of the file.
So to see if that file is really there ... from moodledata/filedir/ and example is for Linux (you've not mentioned your platform so adjust accordingly):
cd moodledata/filedir/93/99/
ls -l
IF there are multiple files (and there can be multiple files) there the last command will shows something like:
[root@moodle filedir]# ls -l 93/99/93*
-rwxrwxrwx. 1 apache apache 59873 Dec 14 2014 93/99/9399128936a439c8e3b2ae0e912e22b2f787984b
-rw-rw-rw- 1 apache apache 9238419243 May 27 2016 93/99/9399b6014a19dd0f25112d02ee29f6ae8fe0d952
-rw-rw-rw- 1 apache apache 1067 Nov 22 08:20 93/99/9399fffedb19dc116fcf47f80bd401f4a0a26888
See the middle listing above? That's the backup file in the meta data of the DB.
file -b command shows it's a gzip
[root@moodle filedir]# file -b 93/99/9399b6014a19dd0f25112d02ee29f6ae8fe0d952
gzip compressed data, from Unix
Other ...
Do you have autobackups turned on? If so, are the backups automatically saved to 'file area' ... which is moodledata/filedir/
Is cron successfully running?
IF not, then the crons to move files from fiiledir to trashdir to empty the trash isn't doing it's job.
It's rare, but a poster asked a question about .core files he was seeing in various locations of moodle code. See any of those?
Without some more specific info about system and how it's setup, the above a guess.
'spirit of sharing', Ken
My system has backup turned on.
when i check the sql in the table SELECT * FROM `mdl_files` order by filesize DESC
it showed most of heavy sizes are back-up files. Also, every Sunday an FAIL backup email is sent to admin weekly.
I am not sure the Cron is running successfully or fail. the subject [Fail]......
its content has 2 fails but others may be success.
Thank for your help. I may know the reason. let me delete course backups manually.
Failed messages ... about autobackups? And those are EMail notifications so cron is working to some extent.
IF so, the cron/task list is supposed to clean up temp areas.
If you manually remove backup files from moodledata/filedir/ also remove the record in the DB that referenced them or you'll start to develop 'orphaned file syndrome'. Not a good thing.
Check out what's in /moodledata/temp/backup/ ... might gain some space by removing all files/folders in there manually ... that's safe to do ... no DB references to those other than backup attempts.
'spirit of sharing', Ken
Thank Ken Task so much. Let me remove it manually or let the Cron do cleaning-up.
In the meantime, I will be waiting for moodle 3.3 to move moodledata to cloud where I don't worry about disk space.
Hao.