I am writing this short documentation, because I have a cloud server, that I don’t want to pay for the whole time. I need it at most 2-3 times a month, but the setup is rather extensive.
For backup i use the command:
borg create -v --stats \
$REPOSITORY::'{now:%Y-%m-%d_%H:%M}' \
/ \
--exclude /dev \
--exclude /proc \
--exclude /sys \
--exclude /var/run \
--exclude /run \
--exclude /lost+found \
--exclude /mnt \
--exclude /var/lib/lxcfs
For the restore I copy the repository to a cloud volume. This can be done using sftp or scp. You can use any cloud server from Hetzner for this (afaik).
For a restore you reboot the server into the Rescue system and mount the Cloud-Volume, if not already mounted. In the Rescue system use the following commands to mount the borg repository and systemdisk:
lsblk
# NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
# sda 8:0 0 10G 0 disk
# sdb 8:16 0 38.1G 0 disk
# ├─sdb1 8:17 0 37.9G 0 part
# ├─sdb14 8:30 0 1M 0 part
# └─sdb15 8:31 0 256M 0 part
# sr0 11:0 1 1024M 0 rom
# I know that my cloud volume is 10GB and my system disk 40G
# You may have to adjust the mountpoints in your instance
mkdir /mnt/system
mkdir /mnt/borg
mount -t ext4 /dev/sdb1 /mnt/system
mount -t ext4 /dev/sda /mnt/borg
If you are using a ARM based system, like I am, you have to get the ARM build of Borg at https://borg.bauerj.eu/
wget https://borg.bauerj.eu/bin/borg-1.2.7-arm64 -O /usr/bin/borg
chmod a+x /usr/bin/borg
alias borg=/usr/bin/borg # I am lazy ;)
Change into the directory /mnt/system
cd /mnt/system
Now you only have to initialize the restore using borg
# To get a list of your restore points
borg list /mnt/borg/borgrepo
# enter repo passphrase
borg extract /mnt/borg/borgrepo::2024-02-28_13:53
# enter repo passphrase
After the restore is done, you can reboot into the system and do your cleanup (e.g. check certificates, remove Cloudvolume again to save costs, etc)
Hope this helps you, as it helps me :)