[PVE-User] VZDump: use --sparse on the first rsync

Dietmar Maurer dietmar at proxmox.com
Fri Sep 16 14:41:04 CEST 2011


Thank. Will test that next week.

- Dietmar

> -----Original Message-----
> From: pve-user-bounces at pve.proxmox.com [mailto:pve-user-
> bounces at pve.proxmox.com] On Behalf Of John O. Stevens
> Sent: Freitag, 16. September 2011 14:29
> To: pve-user at pve.proxmox.com
> Subject: [PVE-User] VZDump: use --sparse on the first rsync
> 
> Hello all, and thanks for the good work so far!
> 
> I've noticed that dumps of VZ containers with sparse files take more disk space
> than they should, and so here is my proposed solution.
> 
> Rsync is called two times; this patch uses the --sparse option the first time it's
> called, in order to gain better handling of sparse files, and use the --inplace
> option the second time it's called.
> (The first time rsync is called, normally there are no files for --inplace to work
> anyway)
> 
> jos
> 
> diff -up a/PVE/VZDump/OpenVZ.pm b/PVE/VZDump/OpenVZ.pm
> --- a/PVE/VZDump/OpenVZ.pm        2011-08-18 07:08:03.000000000 +0200
> +++ b/PVE/VZDump/OpenVZ.pm        2011-09-16 11:14:09.000000000 +0200
> @@ -148,7 +148,14 @@
> 
>      $rsyncopts .= " --bwlimit=$opts->{bwlimit}" if $opts->{bwlimit};
> 
> -    $self->cmd ("rsync $rsyncopts -aH --delete --no-whole-file --inplace '$from'
> '$to'");
> +    if ($text eq 'first') {
> +       $rsyncopts="$rsyncopts --sparse";
> +    } else {
> +       $rsyncopts="$rsyncopts --inplace";
> +    }
> +    $self->loginfo ("rsync options: $rsyncopts");
> +
> +    $self->cmd ("rsync $rsyncopts -aH --delete --no-whole-file '$from'
> + '$to'");
> 
>      my $delay = time () - $starttime;
> 
> _______________________________________________
> pve-user mailing list
> pve-user at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-user





More information about the pve-user mailing list