This tutorial shows how to use LXC containers on Turris Omnia (but even in general) to host a Borg backup server. If you find any errors, mistakes or security problems in the text, leave an issue on Github!
Install Container Debian 11 Bullseye
lxc-create -t download -n borgPick Debian -> Bullseye -> armv7l
config container option name borg option timeout 300 #list command '/bin/command --option'
(use vim to edit it)
Start the container with
lxc-start borgand attach to the container with
Now you’re in a Debian environment. First you run
apt update && apt upgrade -yto stay up to date. Then you can change the password for root with a simple
passwd. Pick a strong password as this will get used to connect to the Borg server. Install OpenSSH
apt install openssh-serverand edit the config file to make it possible to connect.
Change your hostname from LXC_NAME to something more appropriate:
vi /etc/hostnameAfter that you restart the container. Exit the container with
lxc-stop borgto stop it and
lxc-start borgto start it again. While you’re at it you can even test the SSH connection.
To test the SSH-connection you can open a new SSH connection directly into the container without going “via the router”. Find your containers IP address in LuCI or with
ip ainside the container. You can login with
ssh root@<ip>and it should show the new hostname in the shell.
Now you can install borgbackup with
apt install borgbackup.
Create a folder in the container
Exit the container and edit the container config file
vi /srv/lxc/borg/configadd the line:
lxc.mount.entry = /backup /srv/lxc/borg/rootfs/backup none bind 0 0
Now you’re ready! The folder
/backupis your hard drive! Create a folder in
Initialize the borg repository:
borg init --encryption=repokey /backup/borg_01and follow the steps to initialize and use it.
To backup to the server, simply write
borg create --stats root@<ip>:/path/to/repo::<name> <to_be_backed_up_folder>. For example
borg create --stats email@example.com:/backup/borg_01::Sunday /media/external_01. The following steps include your userpassword, repository-password and then you can follow the backup running.
Image by Shubdham Dhage