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

Doulos Xavier -
回帖数: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. 

回复Doulos Xavier

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

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 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.
回复Howard Miller

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

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
回复Howard Miller

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

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)
回复Doulos Xavier

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

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 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.
回复Doulos Xavier

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

Ken Task -
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.

回复Ken Task

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

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?
回复Doulos Xavier

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

Ken Task -
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

回复Doulos Xavier

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

Rick Jerz -
Particularly helpful Moodlers的头像 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.