[pve-devel] [pve-container] Exclude .zfs dir on vzdump

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Sep 1 13:53:03 CEST 2017


On Fri, Sep 01, 2017 at 01:38:03PM +0200, Wolfgang Link wrote:
> The .zfs snapdir is normally hidden, but when it is set to 'visible' we back it up.
> On restore vzdump try to write .zfs dir what is always read only.

but shouldn't the user of such a non-default config adapt exclude_dirs
manually? we don't exclude other potentially problematic stuff that
might be there.. also, .zfs is not always readonly, you can enable
snapshot creation and renaming via .zfs with the zfs_admin_snapshot
module parameter..

> ---
>  src/PVE/VZDump/LXC.pm | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
> index 45a851c..ccf192f 100644
> --- a/src/PVE/VZDump/LXC.pm
> +++ b/src/PVE/VZDump/LXC.pm
> @@ -35,6 +35,9 @@ my $rsync_vm = sub {
>      push @$rsync, map { "--exclude=$_" } @{$self->{vzdump}->{findexcl}};
>      push @$rsync, map { "--exclude=$_" } @{$task->{exclude_dirs}};
>  
> +    # exclude snapdir if it is enabled
> +    push @$rsync, "--exclude=/./zfs";
> +
>      my $starttime = time();
>      # See the rsync(1) manpage for --relative in conjunction with /./ in paths.
>      # This is the only way to have exclude-dirs work together with the
> @@ -48,6 +51,7 @@ my $rsync_vm = sub {
>      foreach my $disk (@$disks) {
>  	push @$rsync, "$from/.$disk->{mp}";
>      }
> +
>      $self->cmd([@$rsync, $to]);
>      my $delay = time () - $starttime;
>  
> @@ -351,6 +355,9 @@ sub archive {
>      push @$tar, '--anchored';
>      push @$tar, map { "--exclude=.$_" } @{$self->{vzdump}->{findexcl}};
>  
> +    # exclude snapdir if it is enabled
> +    push @$tar, "--exclude=./.zfs";
> +
>      push @$tar, @sources;
>  
>      my $cmd = [ $tar ];
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list