I keep another moodle blog where i posted much of this content, wondering if its helpful to post if here. The content on this post is relative to moodle 1.9.x.
Site backup - this could mean the entire site, which would include the db and the user supplied files and the application code. I would prefer to look at it more specifically in terms of the database, the course files and the application itself.
Course backup - means backing up both the db and the course files, much of the course content lives in the database, some of the course content lives in files that the course builder and users of the course have provided. When we talk course backup, we are really talking about backing up the files associated with the course.
DB backup - means backing up the tables that comprise the database associated with the moodle application. There should be a 1 to 1 relationship of moodle application - moodle database (moodle is a database intensive application) By its very nature, it has deep ties into many tables in a database. MySQL is the default table that moodle wants to use. PHP is the scripting language that moodle uses to synch up with its database, MySQL is the scripting language that the db uses to pull and match data from the tables with the specific user, course, etc.
Backing up the DB
The db is a key entity to backup. There are a number of provisions available to you to accomplish this. Unfortunatly, its a little confusing since moodle is open source, there are many options avail. Not as much black and white as people might expect or want, more shades of grey.
We have a dedicated application server where all 12 of our different moodle instances live. We call this our moodle farm or moodle application server. There are no databases on this server, just application files and uploaded files.
The databases are stored on a separate server that we call the moodle db farm. On the moodle db farm is a MySQL Administration tool ( version 1.2.14), that came from here. There are Backup and Restore options that we use to create a complete backup of all the db instances, once a week. We keep 3 copies of weekly backups on the server. I considered creating a backup for each db instance separately, but it was more streamlined to have each of the db instances (6 total) back up together into a single backup file that follows this naming scheme: moodleBackup_date.sql. I am writing a script that will automatically copy these backups to another drive on our network, double dog backup.
Currently the size of the backup file is about 730 MB. Thats actually for six db instances, not 12, since 1/2 of our dbs instances are on the application farm, but i am planning to move to the db server. Once all 12 are on the db server, that backup file size would increase to about 1460 MB or 1.4 GB. That seems a little large to me, i will have to investigate this a little further. Perhaps the individual backup idea will make a comeback.
If we had a db failure, I would load the lastest backup into the GUI admin tool and choose which instance to restore.
Backing up the user/course files
I believe in pushing the responsibility to the course creator to backup their own course(S). Moodle makes provision for this.
The course creator can backup the course by simply using the native Backup feature avail. in all course menus. After completing the course backup, there would be a \backupdata folder created with a zip file of the course files. This folder is located beneath the course id folder which is beneath the \moodledata folder with is located where the site config.php file states.
Automating course backups
Moodle will allow you to automate this course backup process by choosing Backup from the Courses Menu
Site Admin | Courses | Backups - similar options are avail. as with single course backup. You can configure this backup to run nightly. The result of this automated backup process is the same as with a single course backup, a zip file located within a backupdata folder, like this
pathtomoodledata\courseID\backupdata\course-name.zip
When creating your automated backup plan, you can choose WHICH files to backup. The backup zip files can get rather large and probably don't need to. You can choose to backup only user_files or course_files and omit site files, for example. The more types of files that you choose to backup, the larger the zip file, if you have a lot of courses included in this backup, it could take a long time to complete and eat up a lot of drive space.