This guide explains how to set up a Hetzner Storage Box as a backup destination instead of using an internal Clan backup server. Follow the steps below to configure and verify the setup.
Begin by creating a Hetzner Storage Box account.
Set up a sub-account for your jon machine. Save the SSH password for this account in your password manager for future reference.
clan.nixAdd the BorgBackup service to your clan.nix configuration. In this example, the jon machine will back up to user-sub1@user-sub1.your-storagebox.de in the borgbackup folder:
inventory.instances = {
borgbackup = {
module = {
name = "borgbackup";
input = "clan-core";
};
roles.client.machines."jon".settings = {
destinations."storagebox" = {
repo = "user-sub1@user-sub1.your-storagebox.de:/./borgbackup";
rsh = ''ssh -p 23 -oStrictHostKeyChecking=accept-new -i /run/secrets/vars/borgbackup/borgbackup.ssh'';
};
};
};
}; Run the following command to generate the SSH private keys:
clan vars generate Add the generated SSH public key to the user-sub1 account by running:
clan vars get jon borgbackup/borgbackup.ssh.pub | ssh -p23 user-sub1@user-sub1.your-storagebox.de install-ssh-key Apply the changes to your Clan setup by executing:
clan machines update Check if the configuration works by starting the BorgBackup service on the jon machine:
systemctl start borgbackup-job-storagebox.service & Then, inspect the service logs to ensure everything is functioning correctly:
journalctl -u borgbackup-job-storagebox.service