How to Backup your Website on Servebolt

Websites and their code are constantly changing, so it’s important to have a backup of your site in case it gets hacked or something goes wrong with an update, code change, or file removal. Servebolt runs daily and nightly disaster recovery backups of your sites, but it’s also crucial to be able to revert to an earlier version of your site yourself. This way, you can restore the exact version of your site that you need, when you need it.

How to backup a WordPress site using SSH

If you prefer to create a backup manually, you can do so fast and easily using SSH. To do this, you’ll need to log in to your site using your SSH user and run the following commands:

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

This will back up your WordPress database to the ~/private/ directory.

Next, you’ll need to back up your WordPress files. To do this, run the following command:

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

This will create a compressed archive of your ~/public directory where all your WordPress files live, and place it in the ~/private/ directory. Keep in mind that these backups will use storage on the Bolt you are running the backups on, so be sure that you have enough storage available.

How to restore a WordPress site

To restore a WordPress site from a backup we did in the previous steps, you’ll need to log in to your site using SSH and run the following commands:

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

This will restore your WordPress files from the backup archive we placed in ~/private.

Next, you’ll need to restore your WordPress database. To do this, run the following command:

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

This will restore your WordPress database from the backup file.

How to backup other CMS sites

The process for backing up other CMS is similar to the process for backing up WordPress sites.

Here is how to create a backup of your files and database in just a few minutes. Log in to the site you want to back up using SSH.

With the following command, we will create an archive of all your files and a backup of your database:

mysqldump --single-transaction -u DB_USER -p DB_NAME > $HOME/private/db_backup.sql && tar -czvf $HOME/private/file_bck.tgz --absolute-names --transform='s|^.*public/||' $HOME/public

This will create a compressed backup of your database and website files, saving disk space. Your database will be stored in the /private directory of your site as db_backup.sql and your files as file_bck.tgz. Note that this may take some time, depending on the size of your database and website. The backup will also use storage on the Bolt you are running the backup on, so be sure that you have enough storage available.

How to restore your site

To restore your site from the backup you created using the mysqldump and tar command, you can follow these steps:

Log in to your site using SSH on the Bolt server where your site is, and run this command from root:

mysql -u DB_NAME -p DB_USER < $HOME/private/db_backup.sql && tar -xvf $HOME/private/file_bck.tgz -C $HOME/public && rm -rf $HOME/public

Please remember to edit “DB_NAME” and “DB_USER” to your database credentials. You will also be prompted to enter your database password.

Your site should now be restored to its previous state.

SFTP: How to backup your files

In this method, you will connect to your Servebolt-hosted site via SFTP using FileZilla and download a copy of your files to your local machine.

1. Open FileZilla and log in with your SFTP credentials.

An image of how to connect to your Servebolt site with FileZilla.

Download files to your local machine:

When you are successfully connected to your site using FileZilla, you will see a section on the right-hand side called “Remote site.” This is where you will see the files of your website hosted by Servebolt.

On the left-hand side, you will find a section called “Local site.” This is where you will see the folders of your local machine.

To download files, navigate to the folder or file you want to download on the “Remote site” section and drag-and-drop them to the “Local site” section on the left-hand side. Alternatively, you can right-click the folder(s) or file(s) you want to download and click “Download.” Wait for your files to download, and then you are done.

An image showing how to mark all your files in FileZilla on your site to download to your local machine.

How to restore your backed-up files (optional):

To restore backed-up files, navigate to the folder or file you want to restore on the “Local site” section and drag and drop them to the “Remote site” section on the right-hand side. Alternatively, you can right-click the folder(s) or file(s) you want to restore and click “Upload.”

An image showing how to upload your files again from an local backup in FileZilla.

If you try to upload a file that already exists in the remote location, you will get some options. The default action in FileZilla is “overwrite” and will write on top of the file that is already uploaded. This means that the file you are uploading to the remote location will overwrite the already existing file. If that is what you want, then click the “OK” button and wait for your file to be uploaded.

An image showing how to overwrite your current files with the backup you created in the previous steps with FileZilla.

Conclusion

Backing up your website is an important step in protecting your data and ensuring that your site can be restored in the event of a problem. Servebolt makes it easy to back up your site with its daily and nightly disaster recovery backups, but it’s also a good idea to create your own backups regularly. This way, you will have a backup of your site that you can restore at any point in time.

There are two main ways to back up your website on Servebolt: using SSH or using SFTP. The SSH method is a bit more technical, but it’s also the fastest and most efficient way to back up your site. The SFTP method is a bit easier to use, but it may take longer to back up your site, depending on the size of your website.

Whichever method you choose, be sure to back up your site regularly and store your backups in a safe place. This way, you’ll be able to restore your site quickly and easily if anything goes wrong.


Servebolt also runs full daily and nightly backups, off-site to a data centre within EU/EEA.

If you have any questions or need any assistance, don’t hesitate to reach out to Servebolt Support.