Image Missing

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!

  1. Install Container Debian 11 Bullseye lxc-create -t download -n borg Pick Debian -> Bullseye -> armv7l

  2. Edit /etc/config/lxc-auto to:

    config container
            option name borg
            option timeout 300
            #list command '/bin/command --option'
    

    (use vim to edit it)

  3. Start the container with lxc-start borg and attach to the container with lxc-attach borg.

  4. Now you’re in a Debian environment. First you run apt update && apt upgrade -y to 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-server and edit the config file to make it possible to connect.

  5. Change your hostname from LXC_NAME to something more appropriate: vi /etc/hostname After that you restart the container. Exit the container with exit write lxc-stop borg to stop it and lxc-start borg to start it again. While you’re at it you can even test the SSH connection.

  6. 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 a inside the container. You can login with ssh root@<ip> and it should show the new hostname in the shell.

  7. Now you can install borgbackup with apt install borgbackup.

  8. Create a folder in the container mkdir /backup

  9. Exit the container and edit the container config file vi /srv/lxc/borg/config add the line: lxc.mount.entry = /backup /srv/lxc/borg/rootfs/backup none bind 0 0

  10. Now you’re ready! The folder /backup is your hard drive! Create a folder in /backup with mkdir /backup/borg_01.

  11. Initialize the borg repository: borg init --encryption=repokey /backup/borg_01 and 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 root@192.168.0.5:/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