Hi @Avron
The following answer has mainly beginners in focus, which you aren’t, but maybe also answers your question.
Yes, the FreedomBox Borg backup is perfect! for doing a fresh install, move FreedomBox to a different machine or to fix a broken app.
With rsync I can also cover different use cases and copy almost the whole rootfs or specified parts of it like data etc. It can be done to a local storage device or to a remote computer. Rsync comes in to play, if you need to backup Samba or Syncthing, e.g. playlists from my Mopidy music server or whatever you need. There is another possibility for the need of a rsync backup: if it should be the case, that nothing goes anymore and you can’t reach plinth or you are not able to ssh in your FreedomBox anymore, then you can start your dd (or whatever) copy of your OS, even if it is many months old, and just play the latest rsync backup back to your FreedomBox, restart and you have a functioning OS again (it worked as I tested it). With rsync you can also make a remote backup of your local FreedomBox backup, whether it is stored on a local drive or in /var/lib/freedombox/borgbackup/. FreedomBox has a built in ability to remotely backup the FreedomBox. But if you choose to have a remote backup server for more than that, you can backup your fbx with rsync if needed and include the system given backup.
When I started with FreedomBox one and a half year ago, I missed a guide how to make backups from Samba and Syncthing, since I was an adopter of Windows before and didn’t had almost any clue about Linux and computers at all. Somebody reading this has still to work out details and knowledge about rsync etc. But with this an idea is given where to possibly evolve to in the case of simple backups.
Maybe I try to describe my setup, so somebody can use this or parts of it.
Since I run an email server with my family’s main address, I had to set up the whole infrastructure a bit over the minimum. Therefore I have a netgate pfsense+ firewall, which turned out to be a good choice for me. Pfsense+ allows the installation of the package pfblockerNG, which is highly customizable and keeps away most bad ips etc. I allmost do not have any entries on fail2ban on my FreedomBox (sometimes none for days). The firewall is also good, since I can set up WireGuard connections for all family members to reach Samba and Syncthing (this way I do not need to open SSH, Samba and Syncthing ports). And since the firewall does all the math for de- and encryption my Pioneers have more resources to do their task.
All 3 FreedomBoxes are Pioneers:
The hardware setup is on all 3 Pioneers the same: Pioneer with disk bay, where the SSD for data and local backups are located (all SSD’s with LUKS2 encrytion). The OS is on a 32 GB eMMc (RaspiKey) instead of a microSD. This makes it easier (compared to have the rootfs on a SSD) to sometimes dd copy the whole OS. And eMMc makes the storage device more reliable then microSD’s.
freedombox1 (local, static IP)
Data- and media server. Samba and Syncthing for data and Mopidy as music server.
All the Syncthing data is stored in Samba group_share, hence data is accessible over VPN on devices without Syncthing (e.g. a notebook for traveling where you don’t want data on it out of different reasons)
freedombox2 (local, static IP)
Emailserver, SOGo, Bepasty
freedombox3 (remote, DHCP, connectet to firewall/router at a good friends home)
Backupserver with rsync, WireGuard, Mailutils and Postfix (for email notification)
Aditionally to the FreedomBoxBackups I do local and remote backups with rsync, all with cronjobs as root.
RSYNC examples (I have more of them for different needs):
The backups are pulled (fbx3 remotely pulls the backups from fbx1 & fbx2).
In FreedomBox Plinth > System > SSH you find how to configure root pw and ssh connection.
# Backup fbx1 daily Samba (busamba)
15 10,12,15,18,22 * * * rsync -aW --partial --delete --exclude='xy' --exclude='xy' root@192.168.178.45:/media/samba/FreedomBox/shares/ /media/server3/fbx1/busamba
# Backup fbx1 boot daily (buboot)
25 21 * * * rsync -aW --delete root@192.168.178.45:/boot/ /media/server3/fbx1/buboot
# Backup fbx1 rootfs daily (bud)
30 21 * * * rsync -aAHWX --partial --delete --exclude=/.snapshots/* --exclude=/dev/* --exclude=/proc/* --exclude=/sys/* --exclude=/tmp/* --exclude=/run/* --exclude=/mnt/* --exclude=/media/* root@192.168.178.45:/ /media/server3/fbx1/bud
To recover a part or partition in the terminal of the remote backup server, you just need to change input output paths, for example (boot recovery, if the system is running):
# rsync -aW --delete /media/server3/fbx1/buboot/ root@192.168.178.45:/boot
Here is my script for incremental backups of samba with email notification:
The content of the log file gets automatically added to the email, so you do not have to open a file in your mail to display the output. The script is mainly compiled from these sources:
https://wiki.ubuntuusers.de/Skripte/Backup_mit_RSYNC/
https://tecadmin.net/backup-linux-system/
#!/bin/sh
source=root@192.168.178.45:/media/samba/FreedomBox/shares/
target=/media/server3/fbx1/samba_inkr/
date=$(date +%d-%m-%Y_%H:%M)
rm /home/rsynclog.txt
rsync -a --exclude='Pictures' --exclude='xy' --log-file=/home/rsynclog.txt "${source}" "${target}${date}/" --link-dest="${target}last/"
ln -nsf "${target}${date}" "${target}last"
if [ $? -eq 0 ]; then
echo | mail -s "Backup Samba successful" xy@mydomain < /home/rsynclog.txt
else
echo "Backup with error" | mail -s "Backup Samba error" xy@mydomain
fi
exit 0
With the --exclude= option you can recursively exclude folders, e.g. if you want your picture folder with all the subfolders excluded, just add the name of the folder between marks like in the above example.
Now, as I consider myself still as a beginner, there maybe better ways to do some of these steps. But this is how it works for me now, still learning.
I crashed my OS, when I created a cronjob with the wrong syntax on the options in rsync. The example option works in the terminal, but not as cronjob. Do not make a cron job with an option like this: --exclude={/.snapshots/,/dev/,/proc/,/sys/,/tmp/,/run/,/mnt/,/media/}
With this example I just want to say, that I have tried different ways and messed up sometimes (also experimented with the command line versions of backintime, timeshift and rsnapshot - but none was satisfying, rsync was straight forward).