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

Dietmar Maurer dietmar at proxmox.com
Mon Sep 19 08:48:34 CEST 2011


Please can you test:

ftp://download1.proxmox.com/debian/dists/lenny/pvetest/binary-amd64/vzdump_1.2-16_all.deb

This includes the functionality of  your patch (without the loginfo line)

- 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