124 lines
3.4 KiB
Markdown
124 lines
3.4 KiB
Markdown
# Backup Proxmox
|
|
|
|
## 1. PVE
|
|
- Location: verschlüsselt auf hetznerstoragebox gemäß Anleitung https://ralf-peter-kleinert.de/linux-server/proxmox-verschluesselt-backup.html. (Die liegt auch als Anhang im bitwarden)
|
|
- Scedule: täglich im cron und wird 14 Tage aufgehoben
|
|
- ÄNDERUNGEN siehe
|
|
|
|
<details>
|
|
<summary>Location: /etc/fstab</summary>
|
|
```
|
|
#QNAP
|
|
//192.168.178.254/qnapmultimedia /mnt/qnapmount_mm cifs user,credentials=/root/.credentials/qnapcreds,iocharset=utf8,noperm 0 0
|
|
//192.168.178.254/Backups /mnt/qnapmount_backups cifs user,credentials=/root/.credentials/qnapcreds,iocharset=utf8,noperm 0 0
|
|
|
|
#Hetznerbox
|
|
//u358899.your-storagebox.de/backup /mnt/hetznerbox cifs user,credentials=/root/.credentials/hetznercreds,iocharset=utf8,noperm 0 0
|
|
#//u358899.your-storagebox.de/backups /mnt/hetznerbox cifs username=u358899,password=vgceBjPMxwq2eT7k,rw
|
|
|
|
#Storagebox Crypted
|
|
//u358899.your-storagebox.de/backup/backups/proxmox /mnt/storagebox-crypted cifs credentials=/root/.credentials/hetznercreds,iocharset=utf8,rw,_netdev,uid=0,gid=0,file_mode=0660,dir_mode=0770 0 0
|
|
#Storagebox Uncrypted - wird automatisch mit Crypted verbunden
|
|
/mnt/storagebox-crypted /mnt/storagebox-nocrypt fuse./usr/bin/gocryptfs rw,nofail,auto,x-systemd.idle-timeout=10,x-systemd.automount,allow_other,quiet,passfile=/root/.gocryptfspw 0 0
|
|
|
|
```
|
|
</details>
|
|
|
|
- Log: /root/pve-backup.log
|
|
- Skript:
|
|
<details>
|
|
<summary>Location: /root/backup-pve-configs.sh :</summary>
|
|
```
|
|
#!/bin/bash
|
|
|
|
BACKUP_DIR="/mnt/storagebox-nocrypt/pve-configs-backup"
|
|
TODAY=$(date +%T_%F)-pve-configs-backup
|
|
LOGFILE="pve-backup.log"
|
|
|
|
mkdir -p "$BACKUP_DIR/$TODAY"
|
|
|
|
FILES=(
|
|
"/root/"
|
|
"/etc/pve/"
|
|
"/etc/network/interfaces"
|
|
"/etc/hosts"
|
|
"/etc/resolv.conf"
|
|
"/etc/hostname"
|
|
"/etc/timezone"
|
|
"/etc/passwd"
|
|
"/etc/group"
|
|
"/etc/shadow"
|
|
"/root/.ssh/"
|
|
"/etc/vzdump.conf"
|
|
"/etc/ssh/sshd_config"
|
|
"/var/lib/pve-cluster/"
|
|
"/etc/ssh/"
|
|
"/etc/cron.d/"
|
|
"/etc/cron.daily/"
|
|
"/etc/cron.hourly/"
|
|
"/etc/cron.weekly/"
|
|
"/etc/cron.monthly/"
|
|
"/var/spool/cron/"
|
|
"/etc/fstab"
|
|
"/etc/default/"
|
|
"/etc/apt/sources.list"
|
|
"/etc/apt/sources.list.d/"
|
|
"/var/log/"
|
|
"/etc/systemd/"
|
|
"/etc/sysctl.conf"
|
|
"/etc/security/"
|
|
"/var/backups/"
|
|
"/etc/fail2ban/"
|
|
"/root/backup-pve-configs.sh"
|
|
)
|
|
|
|
EXCLUDE_DIRS=(
|
|
"/mnt/storagebox-crypt"
|
|
"/mnt/storagebox-nocrypt"
|
|
"/var/lib/vz/images/"
|
|
"/var/lib/lxc/"
|
|
"/var/lib/vz/private/"
|
|
"/var/lib/lxcfs/"
|
|
)
|
|
|
|
# rsync-Ausschlussparameter erstellen
|
|
EXCLUDE_PARAMS=()
|
|
for EXCLUDE in "${EXCLUDE_DIRS[@]}"; do
|
|
EXCLUDE_PARAMS+=(--exclude="$EXCLUDE")
|
|
done
|
|
|
|
for FILE in "${FILES[@]}"; do
|
|
if [ -e "$FILE" ]; then
|
|
echo "Kopiere $FILE..."
|
|
rsync -aL --relative --ignore-missing-args --safe-links "${EXCLUDE_PARAMS[@]}" "$FILE" "$BACKUP_DIR/$TODAY/" 2>/dev/null
|
|
else
|
|
echo "Warnung: $FILE existiert nicht und wird uebersprungen." >> ${LOGFILE}
|
|
fi
|
|
done
|
|
|
|
find "$BACKUP_DIR" -mindepth 1 -maxdepth 1 -type d -mtime +14 -exec rm -rf {} \;
|
|
|
|
echo "Backup fuer $TODAY abgeschlossen." >> ${LOGFILE}
|
|
|
|
```
|
|
</details>
|
|
|
|
|
|
|
|
## 2. Komplette lxc und VMs #
|
|
- Skript: GUI
|
|
- Log: GUI
|
|
- Location: /QNAP_Bckups/Backups/proxmox
|
|
- Scedule: 0:30, keep-dayily, keep-mpnthly=12, keep-weekly=4, keep-yearly=2
|
|
|
|
- **TODO: Borgbackup für Container**
|
|
|
|
|
|
## weitere Datenbackups
|
|
[=> Paperless Backup](paperless/paperless_backup.md)
|
|
[=> Homeassistent Backup](paperless/homeassistent_backup.md)
|
|
[=> TV-Headend](paperless/tv-headend_backup.md)
|
|
|
|
|
|
|