Quick and easy to backup the Moodle site so that we can restore

Quick and easy to backup the Moodle site so that we can restore

by Doulos Xavier -
Number of replies: 8

Looking for a quick and easy to backup the Moodle site so that we I can restore in case of a disaster. We have our whole server backup running using backup software. We want to add a second layer of back by using 'Automated backup setup' any idea how much of space it will take? don't want to run out of space. 

Average of ratings: -
In reply to Doulos Xavier

Re: Quick and easy to backup the Moodle site so that we can restore

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Do you mean this... Automated_course_backup ?

Nobody can answer that for you. It depends on how many courses you have and how big they are. It's also quite resource intensive.
In reply to Howard Miller

Re: Quick and easy to backup the Moodle site so that we can restore

by Doulos Xavier -
Thanks, this what I am looking at, we have three instance of Moodle on one server, is there way to save backups to an external drive?
 
image.png
In reply to Howard Miller

Re: Quick and easy to backup the Moodle site so that we can restore

by Doulos Xavier -
Hi Howard, does this backup the DB as well? How critical is DB backup to restore the whole site? (apologies if its a naive question)
In reply to Doulos Xavier

Re: Quick and easy to backup the Moodle site so that we can restore

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It creates course backup files. The advantage is that you can then restore a course (e.g. if somebody does something stupid). It's not a replacement for a 'disaster recovery backup'; it's something else, entirely.

Yes - you can point the output wherever you like. The docs I pointed you to explain it.
In reply to Doulos Xavier

Re: Quick and easy to backup the Moodle site so that we can restore

by Ken Task -
Picture of Particularly helpful Moodlers

"... whole server backup running using backup software" ...

and you've tested that?

Actually, maybe a 2nd layer - just moodle stuff ... moodle code, moodledata/filedir/ and DB dump.    You have 2 sites on same server so the following would need to be adjusted for each.

You have to create the backups directory and replace [] below.

As root user:
df -h
That will show how much is used and available.
Your code, db, and moodledata will be in /
You have 2 sites on same server.

So to get exact info
cd /path/to/whereyoucanlsonesite
then 
du -h ./site

That's code.

Find paths to your moodledata directories.   Check config.php file of each site.

Then same:
cd /path/to/whereyoucanlsthemoodledata
then
du -h moodledata/filedir/

DB - mysqldump command to a directory where you are saving the code and minimal moodledata/filedir/

mysqldump --default-character-set=utf8mb4 -u root -p'[password]' [dbname] > [/path/to/]backups/moodle-[moodlevrnumber]-$(date +%Y%m%d%-H%M).sql;

You replace [] above and you create the /path/to/ directory for backups.

For code:
cd /path/to/whereyoucanseemoodlecode
tar -cvf [/path/to/]backups/moodle-[vrnum]-$(date +%Y%m%d%-H%M).tar

will render files something like:

moodle-4116-202502071915.sql
moodle-4116-202502071915.tar

Ditto for moodledata ... 
cd /path/whereyoucanseemoodledata
then
tar -cvf /path/to/backups/moodle-data-[vrnum]-$(date +%Y%m%d%-H%M).tar

'SoS', Ken

Sent you a PM with a reminder.

In reply to Ken Task

Re: Quick and easy to backup the Moodle site so that we can restore

by Doulos Xavier -
Thanks Ken,

When I did df -h 
 
Filesystem             Size  Used Avail Use% Mounted on
tmpfs                  791M  1.1M  790M   1% /run
/dev/mapper/vg00-lv01  116G   77G   34G  70% /
tmpfs                  3.9G  4.0K  3.9G   1% /dev/shm
tmpfs                  5.0M     0  5.0M   0% /run/lock
/dev/vda1              488M  364M   88M  81% /boot
tmpfs                  791M  8.0K  791M   1% /run/user/0
 
When I went to the individual location
root@localhost:/var/www/mywebsite#du -h I get list of files and the size and at the end
365M    ./moodle
8.5G
I checked other two, it is showing 
4.4G and 
2.4G  so combined it is taking 15.3 GB
 
Not sure how much available? How do I go forward?
In reply to Doulos Xavier

Re: Quick and easy to backup the Moodle site so that we can restore

by Ken Task -
Picture of Particularly helpful Moodlers

This line:
Size  Used Avail Use%
/dev/mapper/vg00-lv01  116G   77G   34G  70% /

Your code and data directories are in /

Means you have 34G TOTAL free space.

Your code directories: 15.3 GB

You didn't, however, check size of each sites moodledata directory.
That's where will find a lot more usage of space.  And, in anticipation of the next question regarding moodledata directories, there is generally no way to reduce their size ... they only grow so in the future, you will be using yet more space.

Right now, not looking good 15G from 34G avaiable leaves 18.7 G free space.

Where you host, do they offer attached data devices?

'SoS', Ken

In reply to Doulos Xavier

Re: Quick and easy to backup the Moodle site so that we can restore

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Yes, you can create an automated backup of your Moodle.

Quick and easy? It depends on your computer experience. Do you understand what is described in "Moodle Docs—Site Backup?" Everything you need to know is in the documents.