Affects Version/s: 2.2.1
Fix Version/s: STABLE backlog
Not a solution to the tempdir\backup filling with failed backups but to allow large backups to complete fully run automated backup via cli (be aware of this issue http://tracker.moodle.org/browse/MDL-32548 )ShowNot a solution to the tempdir\backup filling with failed backups but to allow large backups to complete fully run automated backup via cli (be aware of this issue http://tracker.moodle.org/browse/MDL-32548 )
If backup tries to backup a large course and the backup fails to complete successfully a large amount of disk can be taken up in moodledata/temp/backup. Further attemps to complete the same course backups will not reuse the temp directory contents or clean out old contents but instead start again.
This can cause disk space usage to grow to hit limit imposed by host or disk capacity with little or no notification to site admin or entry in server logs. Site functionality could also be affected if no space available for new courses/resources to be added. Unknowningly users with backup permissions could crash site by repeating command to backup large course and fill allocated disk space with incomplete course backups
A side affect of this is non-moodle based backups of db and files take longer because contents of tempdir is larger than necessary
Attempt to backup a large course either manually from backup UI or via automated backups configured via UL. Monitor the moodledata/filedir/temp/backup When the backup fails due to timeout of apache or php (e.g html error 500) the contents will remain along with an blank .log file with the same name as the temp folder which was created, in my case just under 10GB for 1 course
rerun the backup again and a new folder will be created in the temp directory but without cleaning up the 1st attempt
1) Log start time of backup in logs, with progress updates entered and if backup is not completed in X hours delete the contents of temp\backup folder and notify admin. This would also help admins know how far backups get before they fail.
2) Allow site admin/backup user to see list of tempdir on backup screen and clear as needed
3) Possibly wider benefit from this but allow site admin to list temp dir size and contents and set "time to live" value for contents before cleaned up by cron process
4) Emergency Option if files.api reports problems writing to disk due to insufficient space prompt admin to empty tempdir so users not affected.
5) Impose quota on tempdir size set by site admin and include checking in cron process to warn admin if quota is neared