Restic: Multi-User Syncthing Backup Strategy
Overview
This document covers the backup of multi-user Syncthing data from the Syncthing-LXC (ID: 130) via the Vault-LXC(ID: 150). We utilize a single unified Restic repository on the NAS to maximize deduplication across common files shared between users.
Storage Configuration
Individual ZFS subvolumes for each user are passed to the Vault-LXC as Read-Only mount points.
| User | Host Source (ZFS) | Vault-LXC Mount Point |
|---|---|---|
| UserA | tank/subvol-130-disk-2 |
/source/sync-usera |
| UserB | tank/subvol-130-disk-3 |
/source/sync-userb |
| UserC | tank/subvol-130-disk-4 |
/source/sync-userc |
# Executed on Proxmox Host to map disks
pct set 150 -mp132 /tank/subvol-130-disk-2,mp=/source/sync-usera,ro=1
pct set 150 -mp133 /tank/subvol-130-disk-3,mp=/source/sync-userb,ro=1
pct set 150 -mp134 /tank/subvol-130-disk-4,mp=/source/sync-userc,ro=1
The Unified Backup Script
/root/scripts/backup-syncthing.sh (Vault-LXC):
#!/bin/bash
# Auth & Network (Direct 2.5GbE Pipe)
export RESTIC_REPOSITORY="rest:http://vault-user:Pass123@10.1.1.2:8000/syncthing"
export RESTIC_PASSWORD="Sync_Encryption_Key_44"
# Define users and their source directories
declare -A users=(
["usera"]="/source/sync-usera"
["userb"]="/source/sync-userb"
["userc"]="/source/sync-userc"
)
# 1. Individual User Backups (Enables granular recovery)
echo "Starting Syncthing Backups..."
# Loop through users and perform backups
for user in "${!users[@]}"; do
source_dir="${users[$user]}"
restic backup "$source_dir" --tag "user:$user" --host "syncthing-srv"
done
# 2. Global Prune (Keep last 7 days for all users)
# Run locally on NAS if server is in --append-only mode
restic forget --keep-within 7d --prune
Administration & Recovery
How to list files for a specific user:
To see only Sarah's backups without cluttering the list with other users:
restic snapshots --tag "user:sarah"
How to restore a single user's data:
If Werner accidentally deletes a folder, you can restore his latest snapshot specifically:
restic restore latest --tag "user:werner" --target /tmp/restore-werner
Maintenance Notes
- Deduplication Advantage: If Carsten and Sarah both download the same 2GB ISO, Restic only stores the blocks once in the NAS repository, saving significant space.
- Integrity Checks: Run
restic checkonce a month from the Vault-LXC to ensure the NAS data remains uncorrupted.
Restic Guide: Backing Up Multiple PCs
This video explains how to manage a single repository for multiple sources using tags and hostnames, which is exactly how you are organizing your individual Syncthing users.