System-level backups cannot be configured or executed from within Moodle. Instead, they will have to be set up on the system (shell) level. If your system is hosted externally, there is a possibility that you will not have access to the system level, which will prevent you from performing this type of backup. Unless the host already runs system-level backups on your behalf, it is time to change to another provider!
There are two types of system backups that are not mutually exclusive:
Moodle distinguishes between the application software itself and the data that is stored in it. The advantage of this separation becomes apparent when creating backups: a software backup is only required when an update has been installed or customization is taking place, whereas, data has to be backed up more frequently.
Backing up the Moodle software itself is straightforward. All you have to do is to create a copy of the directory and all its subdirectories where the Moodle software is installed (usually called moodle
). Most administrators would create a single archive of the directory for easier handling (in Unix, use the tar command with the –cvf
parameter called tar -cvf <backupfile>
). This step is usually only required before a system upgrade or when you need to archive your entire system.
Moodle stores its data in two separate locations:
phpMyAdmin
(if installed) or use the following mysqldump
shell command for MySQL to create a single backup file:mysqldump -u <username> -p [-h <databasehost>] -C -Q -e -a <database> > <backup-file>.sql
<username>
option has to be replaced with the -p
database username and will ask you for a password, and–h <databasehost>
is only required if the database is located on a separate server. The <database>
option is the name of the database, and <backup-file>
is the name of the archive to be created. It is common practice to use the .sql
extension.mysql
shell command:mysql -p <database> < <backup-file>.sql
For more information on mysql
and mysqldump
, check out the reference sites at http://www.mysql.com/. For other database types, refer to the respective administration guides.
TAR
command with the –cvf
parameters).The advantage of this approach is that it is less resource-intensive, can be scripted, and recovery of the full Moodle system is far more straightforward. However, it is impossible to retrieve individual activities without setting up a temporary server, as is possible with course backups.
The creation of snapshots is only briefly mentioned for completeness as it is not a Moodle administrator role but a system administrator task. However, you should make sure that such a mechanism is set up in case of any hardware failures or as a way to run a reliable backup of your system.
A snapshot is basically an image of the entire partition on the hard disk that contains the Moodle software itself as well all the data (database and data directory). The advantage of the snapshot is that the entire system can be rolled back to the point when the image was created. However, any data that has been added or modified since this point in time will be overridden. Snapshots cannot be used to recover a single course or parts thereof, but can only be used for a full replacement of the system.
18.226.34.25