Tuesday, October 22, 2024

Deleting many GBs of course content from Moodle

Deleting large courses had a tendency to make one of our Moodle instances time out. As I found out by trial and error, and as mentioned at https://moodle.org/mod/forum/discuss.php?d=207712
in such cases, we have to delete module by module, I guess. That worked, but found that for one of our instances, there were still many GB of data in the moodledata filedir, so probably it was data which was not referenced in the database, due to earlier site cloning. 

cd /the/moodle/directory
moosh file-dbcheck > /path/to/filestodelete.txt

Then I just edited the filestodelete.txt to pre-pend sudo rm -f to each filename in the list, and ran it to get rid of around 8 GB. Completed in less than a minute. 

No comments:

Post a Comment