[pve-devel] [PATCH] Fix LXC migration from local subvol

Wolfgang Link w.link at proxmox.com
Mon Mar 21 16:13:14 CET 2016


This patch reconfigured the rsync parameters, so the fs keeps all settings and works recursive.
---
 PVE/Storage.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index e7ff5a0..415301a 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -461,7 +461,6 @@ sub storage_migrate {
 		run_command(['/bin/cp', $src, $dst]);
 
 	    } else {
-
 		run_command(['/usr/bin/ssh', "root\@${target_host}",
 			     '/bin/mkdir', '-p', $dirname]);
 
@@ -475,8 +474,15 @@ sub storage_migrate {
 				outfunc => sub {});
 		}
 
-		my $cmd = ['/usr/bin/rsync', '--progress', '--sparse', '--whole-file',
-			   $src, "[root\@${target_host}]:$dst"];
+		my $cmd;
+		if ($format eq 'subvol') {
+		    $cmd = ['/usr/bin/rsync', '--progress', '-X', '-A', '--numeric-ids',
+			    '-aH', '--delete', '--no-whole-file', '--inplace',
+			    '--one-file-system', "$src/", "[root\@${target_host}]:$dst"];
+		} else {
+		    $cmd = ['/usr/bin/rsync', '--progress', '--sparse', '--whole-file',
+			    $src, "[root\@${target_host}]:$dst"];
+		}
 
 		my $percent = -1;
 
-- 
2.1.4





More information about the pve-devel mailing list