How to backup your WordPress site

We include a daily and a nightly backup of all files and databases for our clients. These backups are performed nightly and can be restored through our support, as described here: How do backups work at Servebolt?

It’s also possible to do an instant manual WordPress site backup. This is recommended when performing a larger install or update of WordPress, themes, or plugins. A complete site backup requires backing up both files and the database.

With an instant backup, it’s possible to restore a WordPress site in just a few minutes.

In this guide, we will back up everything to the ~/private/ directory, which is inaccessible from the internet. We will execute the backup commands using terminal access through SSH.

Note that the manual backup will require additional storage on your Bolt. If you need more storage, simply log in to our Control Panel and upgrade your plan or add more storage. Additional storage added through our Control Panel is available immediately. Downgrading extra storage will give you credits which will be used to pay your invoices going forward automatically.

Lastly, be aware that files (plugins, images, etc.) that were added after you did the backup will not be deleted when you restore the files again with this method. You can also end up with duplicate files this way. Be sure to double-check the files afterwards, or delete everything before you do the restore if that is your intention.

Backup and restore a WordPress site using SSH

Time needed: 10 minutes

Here is how to create and restore a backup of a WordPress site in just a few minutes.

  1. Backup the database

    Login to the server using your SSH user and run the command:

    cd ~/public/ && wp db export ~/private/backup.sql

    This is the easiest way to back up the database of a WordPress site. If it does not work, you can also back up the database as described here: Exporting a database.

  2. Backup the files

    In this step we’ll create an archive of all your files, like this:

    cd && tar -czf private/backupfiles.tgz public

    This will create a file named backupfiles.tgz in the ~/private/ directory. It is a compressed archive, to save disk space. Note that this may take some time depending on the size of all files.

  3. Restore the files

    Then we’ll run this command to restore the previously backed up files.

    cd && tar -xzf private/backupfiles.tgz public

    This also requires that the files be backed up using the name backupfiles.tgz. And it may take some time depending on the size of the files.

  4. Restore the database

    To restore the manual database backup, login using SSH and run command:

    cd ~/public/ && wp db import ~/private/backup.sql

    This requires that the database backup was created using the name backup.sql. Once the restoration is done, you’ll see a confirmation of the import process.

Alternative ways of backing up your (WordPress) site

Feel free to contact our Support Team if you have any questions regarding this.