Restoring from a Backup

Restoring your backups is done directly from the server. You may always find your news backup from the /data/backups directory. From this directory you can copy the latest backed up version of your files with the cp-command to your desired location.

The command wp-backup-list-changes lists all that has changed on file-level between present and the last backups. By using this information you can restore a specific portion of the site. With the rdiff-backup -l /data/backups/data command you can list the history of your backups.



For example, you can copy the wp-content directory as it was a during your desired time to the ’wp-content-restore-2017-10-24’ directory by running:

rdiff-backup -r 2017-10-24 /data/backups/data/wordpress/htdocs/wp-content/ wp-content-restore-2017-10-24

After this you may fetch and transfer your desired files from the directory back to your website either with using command line directly or with the SFTP-client of your choosing.

For example, the installed plugins can now be restored by moving into the /wp-content-restore-2017-10-24 directory and running the following command

cp -R plugins/ /data/wordpress/htdocs/wp-content

When the website is restored in to a past state, you also should restore your database. The backup database can be found from the /data/backups/data/db directory and it is possible to restore with the following command

rdiff-backup -r 2017-10-24 /data/backups/data/db/[database_name].sql db_restore-2017-10-24.sql

And after recovering the database dump, it can be imported into database with a command:

wp db import db_restore-2017-10-24.sql

After recovering the website, it's recommended to flush WordPress cache with a command wp cache flush.

For additional information on the rdiff-backup -tool and it's usage can be found from the rdiff-backup website.

Did this solve your problem?