Backups Completing with "Warning?"

Backups Completing with "Warning?"

by United Electric IT Department -
Number of replies: 9

Hello Everyone,


We have been running into an issue with our Automated (and manual) backups. We are running Moodle 2.3.2+ on a Windows Server 2003 machine. When the automated backup runs, and sends us an email, we get the following message stating that 5 courses were OK and the rest are warnings:

So, I decided to look into the error log and found the following errors (clipped) for most of our courses:

Also, we looked at the backup report and it showed which courses had failed. Next, I went into one of the courses that failed and clicked on manage backups, and I got the following message:

 

After that, we found a course that was failing and tried to do a manual backup of that course. It completed with the following message:

When restoring a course, everything seems to work. Any ideas as to why these automated backups are giving these errors? I did also check the perssions of the folders and they are set exactly as they are on my test site that completes automated backups with no issues. I had read somewhere in the forums about clearing out tables in the Database and certain temp files, but these were suggestions given to resolve similar issues. I didn't want to remove anything before checking.


Thanks in advance for the help!

Average of ratings: -
In reply to United Electric IT Department

Re: Backups Completing with "Warning?"

by Ken Task -
Picture of Particularly helpful Moodlers

So what does one see in /moodledata/temp/backup folder?

Know (from experience) removing files manually contained in /temp/backup/ have no ill affect on Moodle.

Just a guess cause not experienced the same issue ... but ...

Read somewhere in forums/docs that the filesdir is cleaned up by moving unlinked files to the trashdir and then removed (that's done by cron job) ... every four days, by default (?).  The automated backups run at a time where the references have been removed but trashdir has not be dumped (?).  Automated backups is also run via cron.

Test sites, even if setup exactly as server, don't get used by users - thus things like filesdir would be different.  See in one of the lines reported 'draft'.  Wonder if that has something to do with it.

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Backups Completing with "Warning?"

by United Electric IT Department -

I have attached the only file that I found in the moodledata/temp/backup folder. If I read through it correctly, it is looking for files in the filedir that are no longer there. There are also files in the trashdir, but I'm not sure if my Cron process is clearing them correctly.


I just forced the Cron to run and everything appears to have completed correctly.

Is there a way to setup "new" automated backups that don't look for these old files? Not sure if there is a table in the DB that needs to be cleared?


Thanks for your quick response Ken!

In reply to United Electric IT Department

Re: Backups Completing with "Warning?"

by Ken Task -
Picture of Particularly helpful Moodlers

Related tables in the DB:

mdl_backup_logs

mdl_backup_controllers

mdl_backup_courses

mdl_backup_files_template

mdl_backup_ids_template

Try this query:

select * from `mdl_files` where `component` like "%backup%";

or this one:

select * from 'mdl_files';

and see if there any files that have 'draft' as some kind of designator.  As I understand that term, it means the link is not quite 'solidified' (for lack of a better term) or 'saved'.  In the second screen shot of your postings here, the error did say it might be a permissions issue (cannot read) and the trace shows 'draft'.

One way to get the automated backup routine to run and see what's going on ... the following for Linux (translate to WinDoz):

Set the automated backups to run 5 minutes from current time.

Then find a way on Windows to constantly view and refresh the view of /moodledata/temp/backup/ directory.  If you had Linux, that would be easy.  From terminal logged on as root user,

cd /moodledata/temp/backup.

Then issue: watch "ls -l" ... that list all files folders in that directory and refreshes information every 2 seconds.

Then, from the browser or command line run the cron job.  The output will show the next run time.  Continue to run the cron job until the automated backups kick in, then focus attention on the terminal window that's displaying the watch command.

One can 'watch' the building of the backup .mbz file.

Is your site a migrated site?  By that I mean, was it at one time a 1.9 converted to a 2.2.x and then upgraded to a 2.3?  If that's true, 'legacy' file system was or should be active.  Turning 'legacy' off in a course that is using the 'legacy file system' could result in strange events.

Have you checked other logs: apache access_log, or error_log?

Like I said, never experienced the issue ... so am making a lot of suggestions/comments which may/may not lead to resolution.  Just gotta keep plugging away here ... unless we can get a true programmer who understands the new file system to jump in here! [Hint!]

'spirit of sharing', Ken

In reply to Ken Task

Re: Backups Completing with "Warning?"

by United Electric IT Department -
Hi Ken, I was able to run the query on the 'mdl_files' table and did get a bunch of results. However, I'm unsure how to tell what is a draft file and what isn't. There was a permissions issue that I noticed the other day where the IIS_USR didn't have permissions on the moodledata folder. I added the permissions and am still getting the same results. Just to clarify, the automated backup "completes with warnings" and if I try to back up a course manually I get the same error. So, I turned on debugging and tried restoring a course from a backup and got the following message stating that it could not read a file on "c:\moodledata/filedir/b0/some file name". Well, I looked in the /filedir on the server and that file isn't there. This site has been migrated from 2.2.3 to 2.3.3. The legacy file system is active as well. However, this particular site is a rebuilt site. The server that housed the original had died and luckily we were able to copy the copy the DB before the server tanked. When we re-installed Moodle on a new server, we did a fresh copy of the install and had it reference our restored DB. My thought is that there is a table somewhere in the DB that is trying to reference the 'old' moodledata filedir folder. Since we rebuilt the site (and didn't copy over the moodledata folder) the files it is looking for no longer exist. Is there a way to clear these records from the DB without causing damage? Thanks again for your help!
In reply to United Electric IT Department

Re: Backups Completing with "Warning?"

by Ken Task -
Picture of Particularly helpful Moodlers

This items:

"copy the DB before the server tanked" (as opposed to mysql dump)

and

"fresh copy of the install and had it reference our restored DB" (without editing the sql dump for new location?)

and

"didn't copy over the moodledata folder" (the biggy!)

Is the problem.  There a reason 'didn't copy over the moodledata folder'?  Unfortunately, that's one of those key pieces in migrating/moving a site.

All those DB references to files are in the DB are hash code.  Moodle also creates folders/directories and filenames using the hash code ... *unique as of the time created*.  Only a uber MySQL DB Admin might be able to clean that up, I would think.

But there is hope ... the backups you run maually appear to 'clean up' the DB.  Just to test how well, have you attempted restore of one of those backups?  Getting everything ... including users/grades/etc?

If that backup restores properly, then the 'easiest' way to clean everything up might be to backup the courses one at a time and restore them.

Yes, I know that's 80+ courses!  No 'easy button' there!

'spirit of sharing', Ken

In reply to Ken Task

Re: Backups Completing with "Warning?"

by United Electric IT Department -
Sorry. Let me clarify. We had created a mysql dump file and moved it to a network storage location. When the OS was corrupted, we could not recover the inetpub/moodle or the moodledata folder. So, we installed a new blank/fresh install of Moodle on a different server, imported the dump file and edited the config file so that it read from the restored database file. I had a feeling that clearing them out of the DB would be messy. I went and tried to backup a course manually and it did complete with errors again. I did rename the backup file to the course name and was unable to find it on the server (guess it's hashed). Then, I went to restore it as a new course and it did restore correctly. I also tried restoring a course from a backup and it also seemed to work correctly. Looks like I'm doing them one at a time! Thanks again for all of your help!
In reply to United Electric IT Department

Re: Backups Completing with "Warning?"

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!  Wish I knew an 'easy button', but don't! :|

Suggestion?

As you 'work' (ugh!) through this be thinking about a site backup strategy.  Bet the more you 'think' about it, the more one will strategize a site backup plan that will avoid a similar situation in the future. ;)

Only reason I mention ... been there ... done that! :| and it did 'hurt'!

'spirit of sharing', Ken

In reply to United Electric IT Department

Re: Backups Completing with "Warning?"

by Ken Task -
Picture of Particularly helpful Moodlers

Just saw this in another posting ... problems are related:

You can turn debugging on, when running the cron.php script

// Add SQL queries to the output of cron, just before their execution
$CFG->showcronsql = true;

// Force developer level debug and add debug info to the output of cron
$CFG->showcrondebugging = true;

https://moodle.org/mod/forum/discuss.php?d=215851

'spirit of sharing', Ken

In reply to Ken Task

Re: Backups Completing with "Warning?"

by United Electric IT Department -

Also, on a side note. I created a new folder on my root of C called moodle_backups. I changed the Automated backup storage setting to specified directory and entered in my C:/moodle_backups.


I kicked off the automated back and watched it created the .mbz files and all of the courses appeart to be there. After it completed, it emailed me and gave me the same message. 5 Backups were OK and The remaining were "Warning".