Backup

Aus MeinWiki
Wechseln zu: Navigation, Suche

Rdiff Backup

Backup erstellen

rdiff-backup /source /destination
  • Backup ohne symbolische Links
rdiff-backup --exclude-symbolic-links  /source /destination

Backups anzeigen

rdiff-backup -l /destination

Restore

  • letzte Sicherung
cp /destination / source
  • ältere Sicherungen
rdiff-backup -l /destination
rdiff-backup /destination/rdiff-backup-data/increments/... /source
  • Wiederhrstellung mittels rdiff-backup-fs
rdiff-backup-fs /mnt/ /destination/rdiff-backup-data/

Entfernen ältere Backups

rdiff-backup --remove-older-than "Datum/Tage(5D)" /destination

Script

#!/bin/bash
logPath1=/var/log/backup/
logFile1=backup$(date "+%y%m%d").log
fileWrite1=$logPath1$logFile1

mount -t cifs -o username="USERNAME",password="PAASWORT" //172.30.4.12/backup /mnt/backup

if [ -f /mnt/backup/mount ]; then
        echo $(date "+%y%m%d-%H%M%S")' Start Backup' >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/bereich/ /mnt/backup/daten1/bereich/ >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/home/ /mnt/backup/daten1/home >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/profile /mnt/backup/daten1/profile >> $fileWrite1
        rdiff-backup --exclude-symbolic-links /mnt/daten1/exchange /mnt/backup/daten1/exchange >> $fileWrite1
        /etc/init.d/postgresql stop
        rdiff-backup --exclude-symbolic-links /var/lib/postgresql/9.3/main /mnt/backup/var >> $fileWrite1
        /etc/init.d/postgresql start
        logger "Externes Backup Erfolgreich"
        echo $(date "+%y%m%d-%H%M%S")' Stop Backup' >> $fileWrite1
else
        echo $(date "+%y%m%d-%H%M%S")' Error Backup' >> $fileWrite1
        logger "Fehler externes Backup"
fi

umount /mnt/backup