From 603f6772b46c9a26a8d705107d7e22b56b5f65b7 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 14 Feb 2018 17:54:26 +0100 Subject: [PATCH] add: vm device type --- backup | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/backup b/backup index 3fd1898..8264e4c 100755 --- a/backup +++ b/backup @@ -62,18 +62,25 @@ BackupVMDiscs() { | grep disk \ | awk '{print $4}') local logFile="" + local DiskType="" for Disk in $Disks; do printf "Disk %s von %s wird gesichert\n\n" "$Disk" "$VM" + DiskType=$(ssh $remoteLogin virsh vol-info $Disk \ + | grep Type | awk '{print $2}') logFile="$backRemotePCPath/backup-$(echo $Disk \ | sed 's/\//-/g').log" - rsync --archive --verbose --sparse --acls --hard-links \ - --relative --progress --human-readable \ - --log-file=$logFile \ - $hardlinkopt \ - $remoteLogin:$Disk $backRemotePCPath + if [ "$DiskType" == "file" ]; then + rsync --archive --verbose --sparse --acls --hard-links \ + --relative --progress --human-readable \ + --log-file=$logFile \ + $hardlinkopt \ + $remoteLogin:$Disk $backRemotePCPath + elif [ "$DiskType" == "block" ]; then + # TODO implement lvm backup + fi done } -- 2.39.5