To provide the MoodleBox image (free as in speech!, see https://moodlebox.net/ and https://github.com/martignoni/moodlebox), I install Moodle on a Raspberry Pi 3. Main reasons for such a tiny server are: hardware price, mobility and access to a Moodle site when no Internet available. MoodleBox is widely used in Africa, South and North-America and in Europe.
For performance reasons, I moved the
moodledata/temp on a RAM filesystem (tmpfs). But RPi RAM size is modest (1GB) and I need to keep
moodledata/temp (typically around 50 MB). This small size is generally not a problem for the temp directory contents, except for backup files, which are written to
moodledata/temp/backup (during backup/restore) and can be very big (typically more than 100 MB).
My solution to this is currently to soft-link the
moodledata/temp/backup directory outside of
moodledata/temp, e.g. to
mkdir -p moodledata/backup; ln -s moodledata/backup moodledata/temp/backup), and then to install Moodle.
This seems to work. However, occasionally, the backup directory is deleted by Moodle, and this deletion breaks (evidently) the backup/restore process, since Moodle can't find
moodledata/temp/backup, can't create it either (since we've a link in this place), and drops an error ("error/cannot_create_backup_temp_dir").
- Where (in the code) and when (and why) is Moodle deleting the
moodledata/temp/backupdirectory? I looked everywhere in the code, without finding it. I can't figure out in which circumstances this occurs. I even tried every scheduled tasks without finding it.
- As a workaround, do you know any way to prevent Moodle to periodically delete the
moodledata/temp/backupdirectory? I tried to change the umask and user and group permissions, but this didn't work.
- As another workaround, I think of re-creating periodically the moodledata/backup directory (via cron). Any thoughts about such a solution?
- Wouldn't it be a good idea for Moodle to have the possibility to store the backup files (sometimes very big!) outside of
moodledata/temp, in a specific location in moodledata (or elsewhere), enabling more flexibility for the sysadmin? This could be a config.php setting, just like CFG->tempdir or $CFG->cachedir.
Any help and/or hint would be greatly appreciated.