Restoring a database backup

There is a number of ways to import a database backup, but we've found the quickest method is to decompress the two files and import using

Compression format

The backups are stored in bzip2 compressed format (for space efficiency). Decompressing this file type can be done with either of 2 utilities, bzip2 or pbzip2. The traditional bzip2 application only uses a single core (and is slower) than pbzip2 which is multi-threaded.

You can install both of these by switching to the root user, and installing the applications.

su -l root
apt-get install pbzip2 bzip2

Running the restore

First, copy and decompress the backups from the read-only backup partition, and write it to var/db.sql

cd /microcloud/domains/example/domains/
pbzip2 -dc /microcloud/backups_ro/mysql/2013-09-04/06\:00\:01/example_magliv/2013-09-04T06\:00\:01_example_magliv_structure.sql.bz2 > var/db.sql
pbzip2 -dc /microcloud/backups_ro/mysql/2013-09-04/06\:00\:01/example_magliv/2013-09-04T06\:00\:01_example_magliv_data.sql.bz2 >> var/db.sql

Then download and restore the backup

wget -O
chmod +x
./ –r