Large course backup will not restore

Large course backup will not restore

by g k -
Number of replies: 1

I am running Moodle Moodle 3.3 (Build: 20170515) on a linux webserver 

Apache Version2.4.25
PHP Version7.0.18
MySQL Version5.6.34


The error message I receive are: 

Error
Can not create file "35/user/draft/997546193/backup-moodle2-course-7-chemh-20170611-1238.mbz"
URL: http://www.
Debug info: MySQL server has gone away INSERT INTO mdlq7_files (contextid,component,filearea,itemid,filepath,filename,timecreated,timemodified,mimetype,userid,source,author,license,status,sortorder,contenthash,filesize,pathnamehash) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) [array ( 0 => 35, 1 => 'user', 2 => 'draft', 3 => 997546193, 4 => '/', 5 => 'backup-moodle2-course-7-chemh-20170611-1238.mbz', 6 => 1499942146, 7 => 1499942146, 8 => 'application/vnd.moodle.backup', 9 => '3', 10 => 'O:8:"stdClass":1:{s:6:"source";s:48:"/backup-moodle2-course-7-chemh-20170611-1238.mbz";}', 11 => 'In Motion', 12 => 'allrightsreserved', 13 => 0, 14 => 0, 15 => '07ff03b94ca69c140eaf819641c772f045e7f614', 16 => 667972551, 17 => '0944db6f05f481684f133d5030f97a0ece429392', )] Error code: storedfilenotcreated

* line 1310 of /lib/filestorage/file_storage.php: stored_file_creation_exception thrown
* line 1373 of /repository/lib.php: call to file_storage->create_file_from_pathname()
* line 302 of /repository/repository_ajax.php: call to repository::move_to_filepool()


Any ideas? This is a large course. The backup is 634 mb

Average of ratings: -
In reply to g k

Re: Large course backup will not restore

by Ken Task -
Picture of Particularly helpful Moodlers

The clue is 'Server has gone away' ... that's your DB server.

For a technical reference:

https://dev.mysql.com/doc/refman/5.7/en/packet-too-large.html

Set max_allowed_packet=32M (value is a guess and a place to start) in my.cnf (config for MySQL DB server).  Then restart your MySQL DB server for the changes to take affect.

Then try to restore your course again.

'spirit of sharing', Ken