Tools for backing up server files

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.9. Up-to-date documentation for the latest stable version of Moodle may be available here: Tools for backing up server files.

There are many ways to back up server files that contain Moodle code and moodledata. Site Backup for Low-tech Users also has information on this subject.

Rsync in linux

For the files, you can use rsync regularly to copy only the changed files to another host:

rsync -auvtz --delete -e ssh /my/backup/directory/

If you want to run the cronscript at the machine you are running Moodle at you have to use following rsync syntax

rsync -auvtz --delete -e ssh /path/to/local/folder/ remoteuser@remoteserver:/path/to/remote/folder/

If you do not want the root mailbox be spammed by statusmails of the rsync use:

 rsync -autzq --delete -e ssh /path/to/local/folder/ remoteuser@remoteserver:/path/to/remote/folder/


If your Moodle hosting provider does not allow ssh (or just do not provide it) and you have simple [File Transfer Protocol FTP] (a File Transfer Protocol) access with a username and a password you can also use:

mkdir /tmp/remote-folder
curlftpfs /tmp/remote-folder
rsync -auvtz --delete /tmp/remote-folder /my/local/backup/folder/
umount /tmp/remote-folder
rmdir /tmp/remote-folder


wget can be used to backup the entire database. For example use something like these commands(tested on cPanel web interface):

wget --http-user=username --http-password=password

and the entire backup of the Moodle code tree:

wget --http-user=username --http-password=password`date +"%-m-%d-%Y"`.tar.gz

Some customization might be needed for other web interface like (webmin?)

See also