Default location of automated course backup files? (Moodle 3.5)

Default location of automated course backup files? (Moodle 3.5)

by David M -
Number of replies: 6

Where are automated course backup files saved by default?

The Moodle 3.5 docs say "If you leave the field blank, then backup zip files will be saved in the backup folder of each course files folder", but doesn't give any indication as to where this is (relative to the DocumentRoot or to moodle-data or wherever it might be)?

The next sentence then suggests that the path to these backup files contains the name "archive", but I have searched my server for this without finding anything relevant.

(We are taking local, and then remote, backups of the database and the moodle-data folder via cronjobs anyway, but the more layers of backup the better, in case needed!)

Thanks for any advice.


Average of ratings: -
In reply to David M

Re: Default location of automated course backup files? (Moodle 3.5)

by Ken Task -
Picture of Particularly helpful Moodlers

Don;'t think you've read the docs correctly ... #5.

"You don’t want to lose your backups at the same time you lose your Moodle site if the drive fails. If you leave the field blank,

THIS NOT QUITE RIGHT: then backup zip files will be saved in the backup folder of each course files folder. That's sota what 1.9 did - not vr 2 nor vr 3.  See ** below.

On a Linux server the path might look like: /home/(your user or domain)/public_html/archive/ or if it's below the publicly accessible folders: /home/(your user or domain)/archive/ if the path is not recognized a red X is shown after saving, otherwise a green check."

For designated ... note it says 'might look like' ... it's an example *IF* one set designated file area to "/home/(your user or domain)/archive/"

in config of autobackups

** Automated backup storage set to: Course Backup File area
Goes to sea of files in moodledata/filedir/

OR if you Choose the location where ...
is a path to an apache readable/writable directory ... the following is real on a Linux box:
like: /var/www/unirepo/autom35/

query of moodle databaes for backup files (which are .mbz ... not zips but gunzips [tar.gz's])

select id,filename,filearea,contenthash from mdl_files where filename like '%.mbz'

will render thusly IF :

id    filename    filearea    contenthash
87    backup-moodle2-course-3-mshare-20180701-1938.mbz    course    0daea4a8e907438a40c386f5fc271e93e05622d3
3391    backup-moodle2-course-1-mdl35-20181121-1225.mbz    automated    fdb7ef3f6794f066ca6e1f40bb92d3232869f83c
3393    backup-moodle2-course-2-sa-20181121-1225.mbz    automated    09c638ac2f0296c682de0b143e747e5ed3aaeba4
3395    backup-moodle2-course-3-mshare-20181121-1225.mbz    automated    e0d16b66d0cceda33bf540d1d82c0fde57a3da61
3397    backup-moodle2-course-4-themetest-20181121-1225.mbz    automated    c7f218e13d0aff494e90bad606151c9a19996130

Because autobackups was set to 'Course Backup File Area', the file is stored in /moodledata/filedir/ by it's contenthash.
Take the 3397 file ... called backup-moodle2-course-4-themetest-20181121-1225.mbz in meta data (the DB) is physicially
in /moodledata/filedir/c7/f2/ and it's name is really c7f218e13d0aff494e90bad606151c9a19996130

** IF one setup a designated directory ...

/var/www/unirepo/autom35
then the files look like:
-rw-rw-rw-. 1 apache apache  7915775 Oct 14 06:50 backup-moodle2-course-20-test_2_1-20181014-0150.mbz

Uhhh ... me thinks the 2nd is better - designated directory.

Clear as mud?   Gotta think on it a bit ... change config in your Moodle then look at the results to grasp it all! smile

'spirit of sharing', Ken


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

Re: Default location of automated course backup files? (Moodle 3.5)

by David M -

Thanks, that's a helpful explanation (although I had to reread it a couple of times to properly understand it!).

It sounds as though it's the Moodle docs that are somewhat unclear/out of date here. The reference to "zip" files seems to be a bit of a red herring(!), because not only are the files not named '*zip', but with the default backup settings they don't even have a filename pattern that you can search for at all.


OK, so if backup files are stored within the "Course backup filearea" they get given utterly meaningless filenames, which makes it virtually impossible to find and identify the backup files, unless you have been able to query the database to find out the actual filenames (which you might not be able to do at the point where you really need those backup files).

As you say, setting up a specific folder in which to create the backups sounds like a much better system, as that way the backup files are in an identifiable location and they also have identifiable/helpful filenames.

Thanks again, your explanation makes the setup much clearer.

In reply to David M

Re: Default location of automated course backup files? (Moodle 3.5)

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!  Yeah ... told ya it would take some effort to understand. :|

Filenames aren't really 'utterly meaningless' considering the history of/progresssion of backups.  And that depends upon one's admin of the Moodle.   The GUI could use more admin only tools (IMHO) - but then again, maybe not - depending.   Have found it difficult to admin everything one needs to admin by GUI alone so have learned DB queries from command line and plain ole command line access quite handy in certain cases.

The filenames do include the  shortname of the course ... depending upon things that could be handy to know ... it also includes a date/time stamp in the name.   That too is handy to know.   However, one has to use the DB to see the location of those backups ... and who made them.

The one thing about saving to a designated directory is granting teachers access to that directory means yet another step with the file system - especially if one's goal is to restrict teachers from seeing all other  course backups ... ie, they see just their own courses.

Nothing is perfect.   So have learned to find 'work-arounds' and in some cases, 'live with it' - it is what it is and proposals for changes to behavior could lead to yet more settings/forms options etc. and privacy settings, etc. ... and if implemented, 'omicron testing'.

2 cent opinions of course ... 'spirit of sharing', Ken


In reply to Ken Task

Re: Default location of automated course backup files? (Moodle 3.5)

by David M -

What I meant by "utterly meaningless filenames" was that the actual filenames saved on disk (when saved in the course filearea) are in fact the "contenthash" values, and those are somewhat unhelpful for any human being who needs to access those files, and what they actually are.

What would otherwise be the filenames that Moodle creates do seem to be perfectly logical and sensible, it just seems strange that the files don't get saved on disk as such(!) in the default location...

...although I see you note that saving to a designated directory could(?) give teachers access to the files saved there. For privacy reasons that would not be desirable. Are (non-site-administrator) users of Moodle actually able to determine the location of the saved backups via the Moodle web interface somehow and/or then access the backup files? (Shell access to the server is limited to only sysadmins, of course.)

In reply to David M

Re: Default location of automated course backup files? (Moodle 3.5)

by Ken Task -
Picture of Particularly helpful Moodlers

We could debate many things about this! smile

Understanding the changes to file system and why those changes were implemented depends upon past experience with series 1 of Moodle.   Back in 1.9.x, if a teacher who taught 2 or more courses had a PDF file they desired to have linked in all of their courses, that PDF would have to uploaded to each course.   Moodledata had course ID directories and that's where all files (as well as backups for that course) were stored ... by humanly re-cognizable names.

In the new file system, that one PDF file could be used in multiple courses ... thus saving space and time and effort by a teacher.

Something you need to explore ... login as a teacher and backup one of that teachers courses.   Where does that backup show?  Now if things have not changed, that backup will go to the teachers private files area ... moodle admin level users can't see that area via GUI.

I do agree that backups *could* be handled differently but that depends ... the question then becomes (as you had mentioned, privacy/ownership etc. is more of an issue in Academia (individual professors/teachers) than it is in a Corp site - when it comes to files/backups, etc.).   It's a problem for the admins ... but not the teachers.  Then there is the difference between a corp moodle and one for Academia - I do admin a couple of K12 sites and several Corp sites - and have had access to small University/College sites for 'jobs'.  Each have a different take on things in general.

I use command line scripts in moodlecode/admin/cli/ for backing up courses ... one reason, web service taken out of the loop for very large courses ... a team taught multimedia course with audio/video files the troublesome course - 130Gig is large and got to the point where it couldn't be backed up via GUI ... let alone restored should something go south with that course.

And we do have to understand ... me included ... that Moodle tries very hard to be one-size fits all ... if not using special plugins.

Sooooo ---- ???? I have *no* 'one-size-fits all' answers! :\  Some, however, will tout that's 'a plus' for moodle ... flexibility ... but not without development of plugins to accomplish.

'spirit of sharing', Ken



In reply to David M

Re: Default location of automated course backup files? (Moodle 3.5)

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi,

"As you say, setting up a specific folder in which to create the backups sounds like a much better system, as that way the backup files are in an identifiable location and they also have identifiable/helpful filenames."

Yes, i think it's better to have them in a dedicated folder.

But if you had made automatic backups in default place before, you'll have to find a way to manually delete previous backups. Some search in this forums should give you good help.

Because the option to automatically delete older backup files (when a certain number/date is reached) only works for the (new) configured area!

HTH,
Séverin

Average of ratings: Useful (1)