Create a backup of your Totara site
  • 21 Jun 2022
  • 2 minutes to read

Create a backup of your Totara site


Article Summary

Database

The right way to back up your database depends on which database system you are using. The instructions below are one way to back up a MySQL database. Another option would be to use a tool such as phpMyAdmin to manually create a backup. The documentation for your database will give more options.

There are many ways to perform such backups. Here is an outline of a script you can run on Unix to back up the database (it works well to have such a script run daily via a cron task):

cd /my/backup/directory
mv Totara-database.sql.gz Totara-database-old.sql.gz
mysqldump -h example.com -u myusername --password=mypassword -C -Q -e --create-options mydatabasename > Totara-database.sql
gzip Totara-database.sql

Character encoding

Make sure that a database backup uses the correct character encoding. In most databases, use UTF-8.

When dumping the entire Totara database, check for possible character encoding issues. In some instances, backups created with mysqldump or phpMyAdmin may not properly encode all of the data. This will result in non-readable characters when the database is restored.

One solution is to use MySQL Administrator 1.1 or another tool that will force a UTF-8 dump of the data.

Tools for database backups

phpMyAdmin is the tool of choice with most web hosting providers.

MySQLDumper is a backup script for MySQL databases, written in PHP and Perl. MySQLDumper uses a proprietary technique to avoid execution interruption when running PHP scripts (the maximum execution time is usually set to 30 seconds). MySQLDumper also cares for the encoding problems mentioned above. It also works with compressed files and allows setting up regular cron jobs for updating and updating to a remote FTP site.

Uploaded files

Through the Totara interface, users can upload or create files and folders. These are located in a directory, often called 'moodledata'. Since they are just files and folders, there are many different ways to backup or copy moodledata.

  • For example, using a file transfer program, copy the entire directory to a different area, drive or computer. Examples of file transfer programs include: FTP, WinSP, wget, rsync.
  • You might use a compression program to create compact files (tar, zip. 7z, XZ, BZIP2, GZIP, and WIM are a few file formats) of the entire directory. This can be done before or after file transfers.

Typically not all files change between regular/periodic backups. A new Site Administrator might want to look into incremental or other efficient backups procedures.

Depending upon the operating environment there are many tools for backing up server files and ways of backing up moodledata. 

Totara code

Backing up the Totara code will be similar to backing up moodledata. 

It is always a good idea to have several backup copies of your Totara code files. While you can always download a fresh base copy of the Totara code from Totara, you might have customised that code previously. It is a good idea to create a separate backup of your Totara code before you customise the code. This includes installing contributed code, themes, and upgrading.

© Copyright 2024 Totara Learning Solutions. All rights reserved. Some content originally obtained via GPLv3 license and continues to be available under GPLv3. All other content is the sole copyright of Totara Learning Solutions. 


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.