Quantcast
Channel: Installing and upgrading help
Viewing all articles
Browse latest Browse all 46873

Re: Moodledata size folder problem?

$
0
0
by Ken Task.  

On recent migration from 1.9.19+ to 2.2.highest, noticed a couple of things.  The 1.9 had certificate addon installed.  Before the actual running of upgrade.php in the 2.2.highest code, manually placed a compat certificate mod in the 2.2.highest code directory.  Ran the upgrade.php.

No errors, an no real problems, however, in looking at the converted data directory, I see some old course ID folders with moddata and   contained therein one eventually finds old issued certificates.   The individual certificate PDF's aren't that large and the site I was working with was small (larger site, more courses with certs issued), but could see how that might through off any calculations one might do in attempting to compare old 1.9 data to new 2.x file system.

Another item as to total size ... after the site was migrated, the 2 might actually determine that teachers were just storing files in their moodle course ID's ... ie, didn't really link to those files in any mod/block, etc.  Thus, Moodle 2, when running cron, sees those files not linked and moves them to the trashdir.  Think the default for emptying the trash is 4 days and will only be emptied when cron is run.  So for a few days, it might be hard to calculate anything accurately.

If you are worried about missing files in the 2, use the Moodle 2 filesystem repo.  What I do, for those that are paranoid about loosing files, create an oldcourses file system repo in the moodle2 data repository directory.  Then copy all the course ID folders (minus #1 [frontpage backup], and each course's backupdata directory and zip backups contained therein) to the moodle2data/repository/oldcourses folder.  If any teacher complains, I get into that course, setup a file system repo and point to their old course ID folder.

All one would need is the right course ID ... if one installed coursesizes in the 1.9, that report showed not only sizes but the course ID folder.

If, BTW, you hadn't cleaned up the 1.9 data directory of all the course ID 'backupdata/backup-blah-blah-blah.zip'  you actually might find those files in metadata and thus also in filedir (hashed of course).

One can query DB for Moodle from command line and dump results to text file for further manipulation.

Here's a script to run from the data directory of a 2 site - looking for  1.9 backup zip files that are just taking up space and 'metadata space'.  Edit (replace [] items), adjust for your system, and make sure each line doesn't line break ... ie, each line on a line of it's own:

 

echo 'Creating contenthash list.';
mysql -u [dbuser] -p[password] moodle23 -e 'select contenthash from `mdl_files` where (`mimetype` like "application/vnd.moodle.backup" and `filename` not like ".") INTO OUTFILE "/var/www/moodle23data/backupscontenthashlist"';
echo 'Listing contenthash list.  [q] to exit listing and go to next step.';
more backupscontenthashlist;
echo 'Creating filename list.';
mysql -u [dbuser] -p[password] moodle23 -e 'select filename from `mdl_files` where (`mimetype` like "application/vnd.moodle.backup" and `filename` not like ".") INTO OUTFILE "/var/www/moodle23data/backupsfilenamelist"';
echo 'Listing backupsfilenamelist.  [q] to exit listing and go to next step.';
more backupsfilenamelist;
echo 'Getting contenthash ....';
for f in $(cat backupscontenthashlist);
do
find ./filedir/ -name "$f">> backupsfilepaths;
echo "Found: "; echo "$f"
done
more backupsfilepaths
echo 'Getting backup file paths ...';
for f in $(cat backupsfilepaths)
do
for n in $(cat backupsfilenamelist)
do
cp -a "$f" ./extracted/"$n";
done
done
echo 'Listing backup files in extracted directory.';
ls -l ./extracted/;
echo 'Cleaning up ....';
rm backupscontenthashlist;
rm backupsfilepaths;
rm backupsfilenamelist;
ls backups*;

Script is not error trapped.  Offered as is.  Use at own risk. Standard 'dis-calmer' ...

'spirit of sharing', Ken


Viewing all articles
Browse latest Browse all 46873

Trending Articles