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

Wolfgang Link w.link at proxmox.com
Fri Sep 1 13:38:03 CEST 2017


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.
---
 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





More information about the pve-devel mailing list