From 50ee6ffedf8a79893e59aa0dd2fcc30362e960a8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 29 Jul 2016 09:48:59 +0200 Subject: [PATCH] Fix #1070: vzdump: handle sparse files in suspend mode In suspend mode we perform two rsyncs with --inplace which is incompatible to --sparse. However, only the second one really needs to do in-place updates, so the first stage should use --sparse instead. --- src/PVE/VZDump/LXC.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm index c4fa2b1..7062bf3 100644 --- a/src/PVE/VZDump/LXC.pm +++ b/src/PVE/VZDump/LXC.pm @@ -17,7 +17,7 @@ use base qw (PVE::VZDump::Plugin); my $default_mount_point = "/mnt/vzsnap0"; my $rsync_vm = sub { - my ($self, $task, $to, $text) = @_; + my ($self, $task, $to, $text, $first) = @_; my $disks = $task->{disks}; my $from = $disks->[0]->{dir} . '/'; @@ -28,7 +28,8 @@ my $rsync_vm = sub { my @xattr = $task->{no_xattrs} ? () : ('-X', '-A'); my $rsync = ['rsync', '--stats', @xattr, '--numeric-ids', - '-aH', '--delete', '--no-whole-file', '--inplace', + '-aH', '--delete', '--no-whole-file', + ($first ? '--sparse' : '--inplace'), '--one-file-system', '--relative']; push @$rsync, "--bwlimit=$opts->{bwlimit}" if $opts->{bwlimit}; push @$rsync, map { "--exclude=$_" } @{$self->{vzdump}->{findexcl}}; @@ -235,13 +236,13 @@ sub copy_data_phase1 { } } - $self->$rsync_vm($task, $task->{snapdir}, "first"); + $self->$rsync_vm($task, $task->{snapdir}, "first", 1); } sub copy_data_phase2 { my ($self, $task) = @_; - $self->$rsync_vm($task, $task->{snapdir}, "final"); + $self->$rsync_vm($task, $task->{snapdir}, "final", 0); } sub stop_vm { -- 2.39.2