BorgBackup creates fast incremental backups over SSH that save space by removing duplicate data. In this guide, you will learn the complete setup process for backing up your production server to a High Storage VPS using BorgBackup to a Storage VPS.
By the end of this guide, you will have a complete backup system that runs automatically every day, keeps your data safe on a remote server, and uses minimal storage thanks to deduplication and incremental backups.
Prerequisites To Back up Your Server Using BorgBackup to a Storage VPS
To follow this guide, you will need the following setup:
You will need two Linux servers, one to back up, which is your source server, and one to store the data, which is your Storage VPS. If you need a high-storage VPS, you can check PerLod Hosting, providing flexible and reliable options.
Also, you must have administrative access to both machines to run the necessary commands.
Install BorgBackup on Both Servers
You must install the BorgBackup package on both the Source server and the Storage VPS, which allows the two servers to communicate and manage your backup data efficiently.
Based on your Linux OS, you can use the commands below to install BorgBackup:
To enable automated backups without manual password entry, you need to set up SSH key authentication. This secure method allows your Source server to log in to the Storage VPS automatically while restricting access to only backup commands.
Generate an SSH key pair on the source server with the command below:
The "command=" setting locks this key so it can only run backups and cannot be used to control your server or run other commands. The restrict option adds an extra layer of safety by blocking all other unnecessary SSH features.
Once you are done, create the backup directory on the storage VPS with the command below:
Bash
mkdir-p/home/borgbackup/backupsexit
At this point, you can test the SSH connection from the source server with the following command:
You should see a message about restricted access, not a shell prompt.
Initialize the Borg Repository
Now that the servers are connected, you need to set up the storage space for your backups. You can initialize a new and encrypted repository on the storage VPS where all your future backup data will be securely stored.
To initialize a new Borg repository, run the commands below from the source server:
Note: The --encryption=repokey-blake2 setting encrypts your backups using a key stored directly inside the repository. You will be asked to create a password for this key, save it carefully, because if you lose it, you will lose access to all your backups forever.
Save the passphrase as an environment variable for automated backups with the command below:
Bash
exportBORG_PASSPHRASE='your-secure-passphrase'
Create First Backup with BorgBackup to a Storage VPS
Once your repository is ready, you can run your first backup. The following command will securely copy your chosen files from the source server to the storage VPS:
Running backups manually for production environments isn't efficient. To ensure consistent data protection, you should automate the backup process using cron, which will execute your backups on a scheduled basis without any manual steps.
This displays total repository size, number of archives, and deduplication statistics.
Conclusion
At this point, you have a complete BorgBackup to a Storage VPS setup that automatically protects your data with encrypted backups. The system automatically compresses your data to save space and runs without manual work.
To stay safe, test restoring your files regularly to make sure your backups work, and keep your encryption password stored securely offline. For critical servers, consider setting up email alerts for backup failures.
We hope you enjoy this guide. Subscribe to our X and Facebook channels to get the latest articles.
BorgBackup saves 50 to 90% of storage space by only storing unique data and ignoring duplicates. The exact savings depend on how much your data changes between backups.
Yes, add --remote-ratelimit=5000 to your borg create command to limit upload speed. You can adjust it according to your needs.
Modify the BORG_RSH variable to include the port: export BORG_RSH='ssh -i /root/.ssh/borgbackup_key -p 2222'
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.