recovery of accidentally deleted courses (v.2.2.6)

Re: recovery of accidentally deleted courses (v.2.2.6)

by Ken Task -
Number of replies: 0
Picture of Particularly helpful Moodlers

Follow up .... IF you do the following *before* the cron job empties files in /moodledata/trashdir/ .. you could recover a deleted backup of a course.

Am showing command line ... use whatever tool you have to browse files on your server.   This assumes you have located moodledata directory (again, path to which is found in config.php file of your moodle code directory.

cd /pathto/moodledata/trashdir

ls -lR (this will show all directories/files in trashdir

Might be a long list (depending), but what one is looking for is date (which would be/should be the date the deletion was made), and file size.

Here's an example (the paths probably do NOT exist on your server ... remember this is an example).  [ENTER] is not part of the command but indicates where/when you press the ENTER key on your keyboard.

[root@moodle trashdir]# pwd [ENTER] (shows what directory am located in)
/mnt/data/hs2moodledata/trashdir

ls -lR [ENTER]

Displays something like this:
[root@moodle trashdir]# ls -lR
.:
total 4
drwxrwxrwx 3 apache apache 4096 Jul  1 19:46 bf

./bf:
total 4
drwxrwxrwx 2 apache apache 4096 Jul  1 19:46 51

./bf/51:
total 1772380
-rw-rw-rw- 1 apache apache 1813139102 Mar  5 14:33 bf51f6c603ccf47ec3d1e1f6d7364cc9b370d375

The backup file that was just deleted (it was first created in Mar of this year) is in:

moodledata/trashdir/bf/51/

and it's name is: bf51f6c603ccf47ec3d1e1f6d7364cc9b370d375

One could copy that file out to another location and rename it on the fly:

[root@moodle trashdir]# pwd
/mnt/data/hs2moodledata/trashdir
[root@moodle trashdir]# cd bf/51/
[root@moodle 51]# ls -l
total 1772380
-rw-rw-rw- 1 apache apache 1813139102 Mar  5 14:33 bf51f6c603ccf47ec3d1e1f6d7364cc9b370d375

mv bf51f6c603ccf47ec3d1e1f6d7364cc9b370d375 /home/myhomedir/somebackup.mbz

'somebackup.mbz' is now a file name that the restore process will recognize.

You could do the command line things with whatever you have to browse files.

If you can't do this, contact hosting provider's helpdesk and ask for assistance.  Send them the link to this forum and this thread.

'spirit of sharing', Ken