Quantcast
Channel: Backup and restore
Viewing all 6662 articles
Browse latest View live

Re: [3.9] Automated backups consumes all disk space and trashdir is full

$
0
0
by Ken Task.  

PHP settings for time outs.  Site Admin Menu - Server - PHP info.

All of this controlled by settings in moodle + what code has in tables.

If it is recyclebin, run this query via mysql client:

select userid,contenthash,filename,filearea,filesize,timemodified from mdl_files where filename like '%.mbz' order by filesize DESC

filearea will show recyclebin if a teacher deleted something ... userid tells you who.

One could turn the recyclebin link display to all the time displayed ... default is to hide it unless there is something in recyclebin.

That way ... one could go into a course and in a course admin menu you could inspect what's in recyclebin ... and force deletion of each item.

The recommendation of running cron job every minute has been the recommendation for a long time.   Not every part of cron/task list will run each time.   The only way I've found to get info/handle on this is to have the cron job redirect to a moodle_cron.log file in /var/logs/ so I could watch in realtime/at any time with tail -f /var/log/moodle_cron.log.

I would hope teachers are cautious about deleting anything in their courses ... keeping for 30 days might be too much 'hand holding'.

What all must understand ... moodle is a shared resource ... by that I mean, a teacher could be using up more than their 'fair share' in a moodle.   Sometimes that is due to nature of course ... obviously a course in digital media (audio/video/etc) is gonna use up more space ... backing up a course is good practice especially after a major assignment due, but is there a reason to keep 10 backups in teachers private area files?

'SoS', Ken


Re: [3.9] Automated backups consumes all disk space and trashdir is full

$
0
0
by Richard van Iwaarden.  

I don't know if it's all lost. Could be. I just do it like this, because else my whole Moodle crashes. And ours is huge. We are talking many terabytes and if the recycle-bin crashes like you describe in you opening post, our site generates several terabytes per day. Could also be related to the 20.000+ courses we have.

Re: Can I backup a course from Mysql and restore to Postgres?

$
0
0
by Walter Byrd.  

I have a moodle 3.7.7 installation on my home server using postgres, and an online moodle 3.7.7 using mysql. I am having trouble backing up, and restoring files, between them. When I backup from my online site, and try to restore to my home server, I get a "Database Error" sometimes.
I have the studentquiz plugin on both sites. This seems to only happen when I try to backup and restore courses that use that plugin.
I don't know if it's because I have different database applications, or something else.

Changing upload_max_filesize in php.ini is not working

$
0
0
by Walter Byrd.  

I have a Moodle 3.7.7 installation on my home server.

I am using lighttpd as my web server.

When I tried to restore a 5.4MB course, I got the error message: "The uploaded file exceeds the upload_max_filesize directive in php.ini."

Looked for my php.ini file and got this:

# find / -name "php.ini" -print
/etc/php/7.3/apache2/php.ini
/etc/php/7.3/fpm/php.ini
/etc/php/7.3/cli/php.ini
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/cli/php.ini

The logical choice is /etc/php/7.3/fpm/php.ini. I removed apache2 from my system. But, to be sure , I edited all of those files. In each file I changed upload_max_filesize = 2M

to

upload_max_filesize = 20M

Then I restarted lighttpd

# /etc/init.d/lighttpd restart
[ ok ] Stopping web server: lighttpd.
[ ok ] Starting web server: lighttpd.

Kept getting the same error.

Tried closing the tab I was using for my site. The opened another tab and reloaded. Tried logging out, and logging back in. Nothing seems to work, I keep getting that error.

Any ideas?

-----------------------------

Update: I forgot about post_max_size, so I went and changed that in all my php.ini files. I was set to 8M, so that should not have been a problem, but I upped it to 20M.

Also, it occurred to  me that lighttpd might not be reading it's config files with just a restart, so I did force-reload as well.

# /etc/init.d/lighttpd force-reload
[ ok ] Reloading web server configuration: lighttpd.
root@fir:/home/walter# /etc/init.d/lighttpd restart
[ ok ] Stopping web server: lighttpd.
[ ok ] Starting web server: lighttpd.

Logged out of moodle, logged back in, same thing. 

--------------------------------

Update 2:

I am using firefox. I cleared my cache. Closed all my tabs, and shutdown my browser.

I brought everything back up, but I am still having the exact same problem.



Re: Changing upload_max_filesize in php.ini is not working

$
0
0
by Walter Byrd.  

Update 3:

Forced php-fpm to reload it's config files:

# /etc/init.d/php7.3-fpm force-reload
[ ok ] Reloading PHP 7.3 FastCGI Process Manager: php-fpm7.3.

That changed my upload limit. But when I try to restore, I get a "Database Error."

---------------------------

Update 4:

Backed up my course, and restored from newly backed up file. It actually worked this time.

Whew.

Accidentally cancelled moosh course-backup, now backups don't work

$
0
0
by Jonathan Tsoi.  

Hi to anyone who wants to read,

I was recently on working on backing-up some courses. I have a simple and dirty bash shell script that, given a course ID and a category ID, would call moosh course-backup for the course ID, then restore that course's backup file into the specific category. I run this script using the nohup command, so that I can continue to continue working on other things in the background.

Unfortunately, my finger got twitchy at one point and I seem to have accidentally cancelled a backup (with Ctrl + C) that was happening halfway through. Ever since then, every other backup I've tried to make will not create the .mbz file needed.

The error message is below, with the bits that I think relevant bolded. Judging from the message, I double-checked that I had the correct permissions for my moodledata directory (which is called /mnt in our server), and I did. Heck, I gave up and have it set to a very open 777 permission right now.

The current setup, as far as I know:

  • 2 CentOS8 servers that are load balanced
  • A common mounted drive that acts as our moodledata folder (some sort of Windows DfsrShare thing, I don't much about it)
  • Moodle 3.7.6

The folder that the error message complains about DOES exist, but the backup.mbz does NOT exist, and that seems to be triggering this error message. I do not know why backup.mbz is not being created. In said folder below, these are its current contents:

  • activities/
  • completion.xml
  • course/
  • files/
  • files.xml
  • gradebook.xml
  • grade_history.xml
  • groups.xml
  • moodle_backup.xml
  • outcomes.xml
  • questions.xml
  • roles.xml
  • scales.xml
  • sections/


PHP Warning:  unlink(/mnt/temp/backup/4de68bb3aa416f9f32de05e4ee3ae38f/backup.mbz): No such file or directory in /var/www/html/moodle/backup/util/helper/backup_helper.class.php on line 126

Warning: unlink(/mnt/temp/backup/4de68bb3aa416f9f32de05e4ee3ae38f/backup.mbz): No such file or directory in /var/www/html/moodle/backup/util/helper/backup_helper.class.php on line 126
Default exception handler: error/cannot_empty_backup_temp_dir Debug:
Error code: cannot_empty_backup_temp_dir
$a contents:
* line 54 of /backup/util/helper/backup_helper.class.php: backup_helper_exception thrown
* line 70 of /backup/util/helper/backup_helper.class.php: call to backup_helper::clear_backup_dir()
* line 68 of /backup/moodle2/backup_stepslib.php: call to backup_helper::delete_backup_dir()
* line 34 of /backup/util/plan/backup_execution_step.class.php: call to drop_and_clean_temp_stuff->define_execution()
* line 181 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
* line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 119 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 337 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 95 of /var/www/html/moosh/Moosh/Command/Moodle23/Course/CourseBackup.php: call to backup_controller->execute_plan()
* line 354 of /var/www/html/moosh/moosh.php: call to Moosh\Command\Moodle23\Course\CourseBackup->execute()

!!! error/cannot_empty_backup_temp_dir !!!

Re: Accidentally cancelled moosh course-backup, now backups don't work

$
0
0
by Jonathan Tsoi.  

Just an update:

If Moodle can't find these temp files to delete them...then we'll just not do any temp file deleting at all! This is a temporary fix so that we can continue to make our courses while we try to figure out why it can't delete a missing .mbz file.

We commented out the code that deletes temporary files. In /moodle/backup/moodle2/backup_steplib.php, in the class "drop_and_clean_temp_stuff", in the function "define_execution", we modified this:


 protected function define_execution() {
        global $CFG;

        backup_controller_dbops::drop_backup_ids_temp_table($this->get_backupid()); // Drop ids temp table
        backup_helper::delete_old_backup_dirs(strtotime('-1 week'));                // Delete > 1 week old temp dirs.
        // Delete temp dir conditionally:
        // 1) If $CFG->keeptempdirectoriesonbackup is not enabled
        // 2) If backup temp dir deletion has been marked to be avoided
        if (empty($CFG->keeptempdirectoriesonbackup) && !$this->skipcleaningtempdir) {
            //$progress = $this->task->get_progress();
            //$progress->start_progress('Deleting backup dir');
            //backup_helper::delete_backup_dir($this->get_backupid(), $progress); // Empty backup dir
            //$progress->end_progress();
        }
    }

Is it a terrible idea to edit source Moodle code? Definitely! We also need to backup/restore +100 courses within a week for all of the teachers in our school division who are teaching remotely, so we picked the lesser of two evils (yes, facing a teacher's disappointment is the greater evil here).

I'm also thinking that if I cancelled the initial backup job halfway through, there were probably some database entries made in tales that keep track of backups and file hashes and other things lihe that. Are there any SQL tables I could look in to clear out malformed backup-related entries? 

Question type supported in IMS CC export


Dealing with course restores with users

$
0
0
by Aaron Batty.  

Okay, folks, I have made a mess, and I would very much like to fix it.

For reasons that I shan't get into here, I have had to do a server migration the dumb and brutal way, with downloaded course backup .mbz files. I backed the classes up with the user data intact.

On the new server, I uploaded the user list from the old server to put the accounts in, as I assumed that they'd need to be there before pulling in the classes. I have since realized that when you back up user data in those .mbz files, it has the whole user in it. Would have been good to know...

Here's where the problem lies, though: I started getting errors on course restore because when I uploaded the user list, I standardized the email addresses to the university email address, which meant changing some people's accounts.

The course restore sees this as a different person and refuses to go through with the user data at all.

Realizing what the problem was, and that the .mbz files had the full users in them, I decided to just delete the student user accounts and let them come back in with classes, and then upload them again to overwrite the offending mail addresses and add back accounts that were in no class this past semester.

This results in no student accounts being restored, probably because (as I recently learned) when you delete an account in Moodle, all it does is flag it as deleted in the database. So I think it's seeing that there was indeed an account with that username, but it's since been deleted, so it doesn't import.

So, database folks, what's my way around this? Here are the ideas I have:

  • Go into the database itself and just delete all the records that have the deleted flag and try again. But will this gorf something else? I don't know that much about databases...
  • Go into the database and flip all those deleted flags to 0 and then go and change email addresses as necessary so the restores go through with user data. (See concern about gorfing something.)
  • Re-upload those accounts with the old email addresses. But will it make entirely new accounts or simply update the ones in the database to be deleted=0 and impute the new email address? If it makes new accounts, I imagine I'll be right back where I am now.
  • Re-upload the accounts with the "new" uni email addresses, and when I run into an issue with a restore, just change that handful of students' email addresses back to their old ones and try again? But, again, will that result in entirely new entries in the database, or simply "undeleted" ones?
Worst case scenario, I guess I could just restore a daily MySQL backup for the whole site from yesterday and pretend this never happened, but... in all these years of administering Moodle, I have yet to have ever had to do that, and I'm very worried that it doesn't work as smoothly as I hope.

(No, I haven't done a test restore of a database. I'm just too scared; I know that's bad. Please don't lecture me.)

For reference, I have about 2800 users, but the vast majority of them are inactive or just ones I've added in case they decide to take a class from a teacher using Moodle. There are maybe only 20 classes that need to be restored. It's not a big site.

(And please don't say, "Well, you should have just started with the moodle directory and database of your old site and upgraded!"—I know. But the massive update that I needed to do would have required stepping through various PHP and Apache versions, when I also needed to change OSes and hardware—so I just decided to start fresh and pull things in the dumb way.)

There's a lot here, I realize, but who here understands the user table in the database? I can't find anything detailed enough anywhere to even know where to start with it.

Re: Dealing with course restores with users

$
0
0
by Ken Task.  

Qualifications for this response ... not a certified DB person, but have run many moodles over the years and for a variety of entities.

My 2 cents ...

In the new site, delete rows 3 -> in mdl_user table.   That will leave you with ID 1 ... which is guest ... set to manual ... do not remove.  And ID 2, the account you created when the moodle was installed.  But ... see below ..

You've not been successful in restoring any courses?  or you have but there are duplicate accounts for what should be student accounts in course backups from old server.  If latter, delete courses.

So site would have only 2 users (guest/first admin) and no courses.

Then take one of your backups from old site - if they do not have 'nu' in the filename of the backup, they should include users.  Pick the largest backup file first ... tweaks may be needed to php and possibly to mysql ... php time for a script to run ... memory a script can consume (php info in site admin menu) + in mysql max_allowed_packets - backups do have large chunks of data - such as in question bank (quizzes).

In those courses, your new admin account should not exist or there will be a conflict.   Moodle protects that admin level account.

Get that largest course backup restored and checked, then the rest should restore without issues.

Exception to what I've said ... plugins ... if you've used addons in old site, install compat versions in new site *before* restoring courses that used them.

Don't worry, at first, about theme ... don't immediately install new theme ... focus on getting courses restored first and site functioning properly before working on the 'fluff' ... ie, how it looks.

Now I know you don't want any 'virtual finger wags' but do make notes of your mistakes in this adventure and internalize them ... and do know that the version you are running will not be 'forever' ... you will have to upgrade the site ... which really is much easier if you do that when versions are closer.

Again ... my 2 cents.

'SoS', Ken


Re: Automatic Backup fails and manual backup does not complete

$
0
0
by Alexander Gres.  

Unfortunately, I have not been able to really narrow down the problem. By disabling parts of the courses in the backup process, I’ve once been able to get an error message “Can not create local file pool file, please verify permissions in dataroot and available disk space”. However, that didn’t really help me too much either. Furthermore, it seems that multiple parts of that course cause that problem. I’ve found a part that causes it even if I just backup that part of the course, however just excluding that part does not solve the problem, thus there must be at least two of them.


Re: Automatic Backup fails and manual backup does not complete

$
0
0
by Ken Task.  

Can not create local file pool file, please verify permissions in dataroot and available disk space

Ok, you got the above once ... did you check on both ... permissions on dataroot ... which is where your moodledata directory should reside.

Command to see ownerships and permissions ...

cd /path/to/moodledata/ (in example, /path/to/ you replace with true path to)

ls -ld filedir - filedir is where files are stored ... but not in humanly re-cognizable names.   That will show ownerships and permissions on that folder ... which should be same recursively on every folder or file contained therein.

Surely you have some interface to server that will show disk space.   From ssh the following command should work (depending upon hosting):

df -h

df = disk free and the -h is option to show the numbers in human terms.

'SoS', Ken

Re: Automatic Backup fails and manual backup does not complete

$
0
0
by Alexander Gres.  

I can’t imagine that permissions could be an issue as the backup of the other 798 courses works just fine. Both the volume where the moodledata folder resides as well as the backup target are far from full.

Re: Question type supported in IMS CC export

$
0
0
by Dan Marsden.  

Hi Allison! smile

The cc export is quite limited and supports the following Moodle question types:
multichoice, truefalse, multianswer, multichoice, match, essay, shortanswer.

Unfortunately this is because the IMS spec is quite limited in terms of the question types it supports - which you can see here:
https://www.imsglobal.org/cc/ccv1p3/imscc_Implementation-v1p3.html#toc-65

The Gift export format supports a couple more than the IMS CC standard and I've seen some external systems implement a Moodle xml import format, but it's unlikely you'll find an external system that will support the massive number of question types supported in Moodle and unfortunately if you're trying to copy stuff over to another system even if they have a similar question type to Moodle you might need to copy/paste the text across manually for each question.

Good luck!!

Re: Automatic Backup fails and manual backup does not complete

$
0
0
by Ken Task.  

Well, when you manually (via gui interface) backup up one of those troubled courses and it gets to 9x.xx% and then stops, go immediately to moodledata/temp/backup/ and see what is the newest directory created and it's contents.
Getting to that percentage of done is either a time out, conflict in task, or course backup too large to *copy* the built .mbz file to final destination.

Have you tried using the backup.php cli script in moodlecode/admin/cli/
That would take your web service out of the loop ... just php and DB server talking then + OS.
That script will show errors if there are any.

Humor me ... what does df -h show.

What modules are in these troubled courses?

'SoS', Ken

Re: Dealing with course restores with users

$
0
0
by Aaron Batty.  

Thanks, Ken!

I've actually done a lot of moves with .mbz files, but I was always using them without the user data in them. I had no idea that they had the full accounts in them. I wish I'd known that; it would have saved me a lot of trouble.

>You've not been successful in restoring any courses?

I've gotten courses to go in without trouble... as long as none of the students had changed their email address in their profile. If I restore without users, there's no problem; I just enroll the teacher back in after restoring. I'd just love to keep the users if possible.

I actually asked the teachers to do resets before I took the site down, but of course no one did.

>Exception to what I've said ... plugins ... if you've used addons in old site, install compat versions in new site *before* restoring courses that used them.

Everything is installed on the new site.

>do know that the version you are running will not be 'forever' ... you will have to upgrade the site ... which really is much easier if you do that when versions are closer.

Here's the longer form of why this has happened: I had been serving this off of a spare Mac using the old "macOS Server" application. They took webserver administration out of that awhile back, and their setup was so bizarre that I could never get the webserver to survive OS or Apache upgrades. I finally just started from scratch with another Mac Mini we had, and set up a standard Apache/PHP/MySQL install. I had hoped to just move over the moodle, moodledata, and MySQL database from the old server and then do an upgrade from Moodle 3.1 to 3.9, but I couldn't get the old Moodle to run in the new environment at all. So I decided to do it this ridiculous way instead. I'd been marooned for a long time.

Most of my backups aren't too big, but in the case of my personal classes (I'm the heaviest user, of course), I'm going to have to bump up those PHP and MySQL values for sure.

I have set expectations low for my teachers, but obviously I'd like the most stuff to transfer over as possible.

Thanks again, and I'll do some database surgery and try again.

I'll let you know what happens.

Re: Dealing with course restores with users

$
0
0
by Aaron Batty.  

UPDATE!

Not crazymaking!

It worked with another class that I had tried last night. Perhaps the courses I was working with had been reset, but unenrolled user accounts still hang around in the record? At this point, it simply wouldn't surprise me... Perhaps they hang around to preserve grade history?

I.e.: It might be working now. Preserving the below for reference.

===============================================================
Okay, here's where we stand now:

  1. I went into the mdl_user table and deleted all the "deleted=1" rows.
  2. I then tried restoring a course that had failed last night to restore with users intact over itself (not a new course). ⇒ It kept the user settings from last night; just the teacher user I had enrolled. However, it still created all the new user accounts. It just didn't preserve their enrollments in the class.
  3. I then tried deleting the previously-restored course and bringing it back in fresh ⇒ Same behavior.
  4. I then tried restoring the course to a different category with a different name to try to trick Moodle into actually treating it as a new course. ⇒ Same behavior.
This is now officially driving me mad. How does Moodle know that this course has been restored before, and that I had manually enrolled the teacher? Looking at the database (mdl_course), it actually does seem to delete courses when you ask, rather than bizarrely flagging them "deleted" and letting them sit there for literally 10 years like I just recently discovered is the case with users.

This is truly crazymaking.

Issue : Import only a few sections from one course into another

$
0
0
by Guillaume Tschupp.  

Good afternoon,

I'm new here, i'm in charge of the moodle plateform for a big school. And I get this issue. I hope to find a solution.

I'm looking to import part of a cours in my cours.

The option does exist -> import - select a cours - select part of the cours ...

At the end of the process the section i'm selecting aren't coming in my cours, only some tools, pages, doc.
I'have tried many times with many different options : previously adding empty section in both courses, modifiing options, selecting only one section or tool, trying exporting or backup as well...

I red in some other forum that  this issue is pretty comon. But I really need this option, as many ohter collegues need to put togehter 2 or more courses, and for now the only option is to rebuild everything !

Did you found any solution. Are some update coming soon to fix this issue?

Kind regards.

Guillaume


Re: Automatic Backup fails and manual backup does not complete

$
0
0
by Alexander Gres.  

The Backup via the Webui got stuck at 99.32%, but neither a file nor a folder got created in the temp directory.

Via the backup.php file I get an error message that, loosely translated, says that the file in the local data directory could not be created and that I should check the rights and available space in the moodle data directory. However, this time a backup.mbz got created in the temp directory with a little over 10.3GB. Yet, there where no filesystem operations targeted at the destination path that I specified. Moreover, I noticed that the php log file now contains an error message:
“Potential coding error - existing temptables found when disposing database. Must be dropped!”
The destination path was a local path, so networking should not be a problem. There is also plenty of space left, it apparently didn’t even try to copy the file it its intended location.

Re: Automatic Backup fails and manual backup does not complete

$
0
0
by Ken Task.  

Well ... no humor me ... do info on df -h ... so let's focus on what it says ..

"says that the file in the local data directory could not be created and that I should check the rights"

Example: destination is /home/coursebackups/  Do both directories exist?  Moodle script won't create them for you ... they must exist already.

What are ownerships and permissions on destination:

ls -lR /home/coursebackups

"backup.mbz got created in the temp directory"

That's the file it is trying to copy ... the size is kinda large but server should be able to handle it ...

What if you, changed into the tmp directory and issued a copy command yourself to the desired destination.

Example:

cd moodledata/temp/backup/aslwerjweasdfasdf (where backup.mbz file resides)

cp backup.mbz /home/coursebackups/

Do that error also?

What if you used sudo for the user web service is running under:

sudo -u webserviceuser cp backup.mbz /home/coursebackups/

'SoS', Ken

Viewing all 6662 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>