From: Bastian Dehn Date: Thu, 15 Jun 2017 17:31:08 +0000 (+0200) Subject: remove: reduntanz hardlinks X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=c4eb01017912e838d8b07e08b710e4aba48e695c;p=simple-backup.git remove: reduntanz hardlinks --- diff --git a/backup b/backup index 07ceb45..7fa4351 100755 --- a/backup +++ b/backup @@ -36,6 +36,10 @@ for remoterechner in $(cat rechner.txt); do remoteuser="root" # Sicherungsordner fuer den Remote-Host erstellen mkdir $sicherungspfad/$sicherungsordner/$remoterechner + # Setze hardlinkopt ob full Sicherung oder incremental + if [ "$mode" == "incremental" ]; then + hardlinkopt="--link-dest=$sicherungspfad/$vorsicherungsordner/$remoterechner" + fi # Sicherung fuer die jeweils angegebenen Pfade # in pfad.txt erstellen inkl. logs @@ -55,9 +59,6 @@ for remoterechner in $(cat rechner.txt); do Disks=$(ssh $remoteuser@$remoterechner virsh domblklist $VM --details | grep disk | awk '{print $4}') for Disk in $Disks; do printf "Disk %s von %s wird gesichert\n\n" "$Disk" "$VM" - if [ "$mode" == "incremental" ]; then - hardlinkopt="--link-dest=$sicherungspfad/$vorsicherungsordner/$remoterechner" - fi rsync --archive --verbose --sparse --acls --hard-links --relative --progress --log-file=$sicherungspfad/$sicherungsordner/$remoterechner/backup-$(echo $Disk | sed 's/\//-/g').log $hardlinkopt $remoteuser@$remoterechner:$Disk $sicherungspfad/$sicherungsordner/$remoterechner done printf "\nFahre %s hoch\n" "$VM" @@ -70,9 +71,6 @@ for remoterechner in $(cat rechner.txt); do Disks=$(ssh $remoteuser@$remoterechner virsh domblklist $VM --details | grep disk | awk '{print $4}') for Disk in $Disks; do printf "Disk %s von %s wird gesichert\n\n" "$Disk" "$VM" - if [ "$mode" == "incremental" ]; then - hardlinkopt="--link-dest=$sicherungspfad/$vorsicherungsordner/$remoterechner" - fi rsync --archive --verbose --sparse --acls --hard-links --relative --progress --log-file=$sicherungspfad/$sicherungsordner/$remoterechner/backup-$(echo $Disk | sed 's/\//-/g').log $hardlinkopt $remoteuser@$remoterechner:$Disk $sicherungspfad/$sicherungsordner/$remoterechner done printf "################################################################\n" @@ -82,9 +80,6 @@ for remoterechner in $(cat rechner.txt); do # Es werden Dateien mit *.qcow2 und *.raw ingnoriert printf "################################################################\n" printf "Rechner %s; Pfad %s wird gesichert\n\n" "$remoterechner" "$pfad" - if [ "$mode" == "incremental" ]; then - hardlinkopt="--link-dest=$sicherungspfad/$vorsicherungsordner/$remoterechner" - fi rsync --archive --verbose --sparse --acls --hard-links --relative --log-file=$sicherungspfad/$sicherungsordner/$remoterechner/backup-$(echo $pfad | sed 's/\//-/g').log --filter="- *.qcow2" --filter="- *.raw" $hardlinkopt $remoteuser@$remoterechner:$pfad $sicherungspfad/$sicherungsordner/$remoterechner printf "################################################################\n" fi