Operating system

Published on February 20th, 2018 | by Sunit Nandi


Set up offsite backup for a Proxmox VE server to HubiC cloud storage using rclone


There are a lot of sysadmins and dedicated server owners and leasees who use Promox VE as their virtualization manager. There are a lots of great things that can said about Proxmox’s feature-set: it is pretty much complete, with support for various cluster types, distributed storage, failover, networking and fine-grained user management. But one thing would take an important mention over other similar products: it is based on Debian, which makes it very easy to extend its features just by having a working knowledge of Linux. Today, in this blog post, I will be explaining how to configure scheduled offsite backups for containers (CT) and virtual machines (VM) running on a Proxmox VE host to HubiC cloud storage so that all your data and applications stay safe. Even if your server faces data corruption or you lose access to your datacentre or dedicated server host for some reason, offsite backups help you get back up on on your feet quickly and back into business. One should never ignore the importance of backups. Also, regular offsite backups do not need to be complex or expensive. Read on to know more.


First of all, you need root access to Proxmox VE host running containers and VMs. As of writing this guide, the latest version is 5.1. So, in this guide, we will perform the steps on a server running Promox VE 5.1.

Second, you need an account at an online storage service. In this guide, I will use HubiC, an offering by OVH. HubiC isn’t a very fancy product. It offers an API and a basic web interface to upload and download files and is a lot behind industry offerings like Dropbox, Google Drive or Backblaze B2. However, you get 10 TB of storage for a measly price of €5 a month, which allows you to backup not just planets but also the entire solar system 😛 . And that too several times over. Since managing backups doesn’t require fancy features, HubiC does the job just fine. If you purchase the annual plan, it is even cheaper at €50 a year. This makes HubiC a better offsite backup plan for Proxmox VE than using the hosting provider’s offering or more expensive solutions like Idera as HubiC paid plan has the same redundancy and replication as the managed servers in OVH datacentres.

Third, while doing this, you must be on a computer running a variant of Linux. Any distro will work.

Fourth, you need rclone, a tool written in Go to backup and sync to online storages, to be installed on both the Proxmox VE host and your local computer. Type the following in a root shell to install rclone on a Linux computer:

Now that we have everything we need, let’s move on to setting up the backups.

Connecting rclone to HubiC

Before we can actually back up anything offsite, we need to connect rclone to the cloud storage. To do that, connect via SSH to the Proxmox VE host and type the following after switching to root user:

You will see something like this:

Type ‘n’ and press Enter to add a new remote to rclone. You will be prompted to give the remote drive a name. We’ll name it ‘hubic’ in this guide. You can name it to anything you wish. You will see something like this:

You can see that rclone supports a large number of remote storages. Since we are setting up HubiC in this guide, type ‘hubic’ in the ‘Storage>’ prompt. A prompt for ‘client_id>’ will appear. Simply press Enter key and let it autogenerate it. You will also see a prompt for ‘client_secret>’. Press Enter on that prompt too. Now you will see the following in the terminal:

Since the Proxmox VE host is a headless machine, i.e., without a graphical environment, type ‘n’ and press Enter. You will see the following instructions now:

Now, do you remember that I had mentioned in the prequisites that rclone must be installed on the local computer too? It is required for this step. On the local computer, open a shell and type:

You will see the following in the shell window:

Also, a browser window will open asking you to provide credentials log in to HubiC. Enter your credentials and click ‘Accept’.

After accepting the permissions, you will be instructed to go back to rclone.

Go back to the shell window. You should see something like this:

Copy the JSON data starting from ‘{‘ till ‘}’. Go back to the Proxmox host’s SSH session window. Paste the text there and press Enter. It should look like this now:

Type ‘y’ to accept the remote drive configuration. You will then see this:

Type ‘q’ and press Enter to exit configuration.

Now, we need to test if rclone is working with hubic properly. Before we do that, it is important to say that HubiC is built on top of OpenStack. So the API defines storage locations called “containers”, similar to “buckets” in Amazon S3. Only the container named “default” is accessible by the web interface and mobile app. I don’t know why this is the case, but we will use “default” for everything to prevent any confusion.

Type rclone --config /root/.rclone.conf ls hubic:default to list files in the “default” container. If it lists files as shown below or quietly returns to the prompt, then rclone has been set up properly.

If it shows shows a credential error, the setup is incorrect or incomplete and you will need to run rclone --config /root/.rclone.conf config , add a new remote and try all the steps again.

Now, we need to see if file transfers work properly. You can transfer any file from the current directory to the “default” container using rclone --config /root/.rclone.conf copy archive.tar.gz hubic:default/ where archive.tar.gz  can be replaced with any file or archive of your liking.

Next, you can use rclone --config /root/.rclone.conf ls hubic:default | grep archive.tar.gz to check if your file has been transferred succesfully. If you see something as shown below, then your file transfer was successful.

If the prompt returns without showing any output, then either app permissions were not granted properly or there could be a network issue. Try doing the transfer again after half-an-hour to see if it works, else run  rclone --config /root/.rclone.conf config again.

Once we can confirm that directory listing and file transfers work, we can move on to the next step.

Hooking rclone to Proxmox VE backup subsystem

To store any Proxmox VE backups, we need a directory in Hubic. We can create one named ‘proxmox’ using by typing:

You can use any other name of your choice.

If you have been running Proxmox VE, you will have noticed that when a backup task is run, vzdump is run to generate snapshots of LXC (CT) and Qemu-KVM (VM) guests. The vzdump utility accepts arguments, which can be specified in the /etc/vzdump.conf file. One of the arguments is a hook script written in Perl.

Before we add the script as an argument we need to create it and save it in the filesystem.

After taking ideas from this script, I wrote the following script to make rclone copy backup files to HubiC after they are generated by vzdump:

You can copy the above script, paste it to a text editor and save it in /usr/local/bin/vzdump-backup.pl on the Proxmox VE host. You can adjust the --min-age 120d  and hubic:default/proxmox/ to your liking in order to decide for how long to keep backups and the backup location respectively.

Now, open the /etc/vzdump.conf  file with a text editor like vi , emacs  or nano . If you have never modified the file below, you will see something like this:

Add the line script: /usr/local/bin/vzdump-backup.pl to the file, so that it now looks like:

Finally, save and close the file.

After this step, rclone is properly hooked to the backup subsystem (vzdump) and is ready to mirror newly generated backups to HubiC.

Performing your first offsite backup

Before we can schedule our offsite backups, we need to test if the backup is actually working or not. For that we back up a single VM or CT guest and see if it copied to Hubic or not.

Go to the Proxmox VE web interface. From the left pane, select a guest and click ‘Backup’.

Once in the backup area where you can see all locally stored backups, click ‘Backup Now’.

In the options, choose the local backup location as ‘local’, choose mode as ‘Suspend’ for best success rate, and choose compression as GZIP to save bytes on storage and also type in your email to alert you in case of an error.

Finally, click ‘Backup’ on the prompt and monitor the progress.

An example of a successful backup log file is given below.

We have finally tested and determined that offsite backups are working as expected. Let’s move on to the final step.

Scheduling backups

Proxmox VE has scheduled backup option right in the web interface. Just click ‘Datacenter’ in the left pane. Then click ‘Backup’. After that, click, ‘Add’ to insert a new backup schedule.

Select the local storage, days of the week, start time, compression, backup mode and the guests you want to take a backup of. Also enter your email for email notifications. Finally, click OK.

That’s it folks! According to the schedule you specified, Proxmox VE will back up your VMs and CTs and also make a copy of them on your HubiC cloud storage.

If you ever log in to the Hubic web interface and browse to ‘proxmox’ folder, you’ll see all your backups available. To download the backup to your computer, just click on it.


After following all the steps above, you’ll have a fully working, reliable and cheap backup plan that will protect you in any data loss or catastrophe. Now you can rest assured that your VMs and CTs are duplicated and easily restorable even if your server is wiped out. Apart from HubiC, rclone supports a variety of other remote storages, so using a different storage provider is merely performing the aforementioned steps with modifications to the configuration and location values. If encryption is required, rclone even has a crypt remote that encrypts and decrypts access to a cloud storage on the fly.

I hope you liked this guide. I have tried to be as detailed and comprehensive as possible. If you want to suggest any improvements or corrections, please feel free to leave a comment below.

Like this post? Share with your friends.
Share on Facebook
6Tweet about this on Twitter
Share on Google+
0Share on LinkedIn
Share on Reddit
0Share on Tumblr
0Share on VK
Email this to someone

Tags: , , , , , , , , ,

About the Author

I'm the leader of Techno FAQ. Also an engineering college student with immense interest in science and technology. Other interests include literature, coin collecting, gardening and photography. Always wish to live life like there's no tomorrow.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top ↑