initial git commit saving configs

This commit is contained in:
Adrien
2026-03-31 15:30:40 +00:00
commit 7770e9859c
64 changed files with 2866 additions and 0 deletions

66
backup.md Normal file
View File

@@ -0,0 +1,66 @@
## 3⃣ Create the backup script on the master node
Create /usr/local/bin/backup-storage.sh:
sudo nano /usr/local/bin/backup-storage.sh
```
#!/bin/bash
set -e
SRC="/storage/"
DEST="debian@192.168.1.30:/backup/master-storage/"
SSH_KEY="/home/adrien/.ssh/id_backup"
LOG="/var/log/storage-backup.log"
echo "=== Backup started at $(date) ===" >> $LOG
rsync -aHAX --numeric-ids --delete \
--link-dest=/backup/master-storage/latest \
-e "ssh -i $SSH_KEY" \
"$SRC" "$DEST/$(date +%F)/" >> $LOG 2>&1
ssh -i $SSH_KEY debian@192.168.1.30 \
"ln -sfn /backup/master-storage/$(date +%F) /backup/master-storage/latest"
echo "=== Backup finished at $(date) ===" >> $LOG
```
### What this gives you
Daily folders (2025-01-14/)
A latest symlink
Efficient incremental backups
Clean deletions mirrored (--delete)
```
sudo crontab -e
0 2 * * * /usr/local/bin/backup-storage.sh
```
### 5⃣ Verify backups on vm-nfs
ls -lah /backup/master-storage
You should see:
2025-01-14/
latest -> 2025-01-14
## 6⃣ Restore (very important)
To restore everything:
rsync -aHAX /backup/master-storage/latest/ /storage/
To restore a single folder:
rsync -aHAX /backup/master-storage/2025-01-10/prometheus/ /storage/prometheus/