I've been maintaining a moodle server for some time now, and have backed up and restored my data a few times. Since I've not blogged about it before, I've not a got a reference on how to do it, until now!
Uploaded images and other files are stored under /var/ftp/pub. They are backed up with:
tar cvzPf moodle.ftp.tar.gz /var/ftp/pub
and restored with:
tar xvP moodle.ftp.tar.gz
The other data for moodle resides in a mysql database. I know I used this reference page from http://dev.mysql.com/doc/refman/5.1/en/backup-and-recovery.html.
To backup the database use:
mysqldump moodle -u root -p > moodle.mysqldump
After installing mysql and setting a root password for it, I login to mysql as root and create the moodle database and user, then restore the file.
# mysql -u root -p
> create database moodle;
> grant all on moodle.* to dbuser@localhost identified by 'password';
# mysql moodle -u root -p < moodle.mysqldump