[pve-devel] [PATCH pve-container 1/9] add function rsync_disk
Wolfgang Link
w.link at proxmox.com
Wed Nov 18 09:29:58 CET 2015
This function copys the content of a container disk,
with the following parameters
--stats "give some file-transfer stats" for print output
--sparse "handle sparse files efficiently"
--whole-file "copy files whole" to need less ressources
--archive "-rlptgoD" to call this para
--acls "preserve ACLs"
--xattrs "preserve extended attributes"
--hard-links "preserve hard links"
--one-file-system "don't cross filesystem boundaries"
--numeric-ids "don't map uid/gid values by user/group name"
---
src/PVE/LXC.pm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index c61df23..beec884 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2105,6 +2105,26 @@ my $check_mount_path = sub {
}
};
+sub rsync_disk {
+ my ($src_path, $dst_path) = @_;
+
+ my $outfunc = sub {
+ print shift."\n";
+ };
+
+ print "starting sync\n";
+
+ my $starttime = time();
+
+ PVE::Tools::run_command(['/usr/bin/rsync', '--stats', '--sparse',
+ '--whole-file', '--archive', '--acls', '--xattrs',
+ '--hard-links', '--one-file-system',
+ '--numeric-ids', "$src_path/", $dst_path], outfunc => $outfunc);
+ my $delay = time () - $starttime;
+
+ print "sync finished ($delay seconds)\n";
+}
+
# use $rootdir = undef to just return the corresponding mount path
sub mountpoint_mount {
my ($mountpoint, $rootdir, $storage_cfg, $snapname) = @_;
--
2.1.4
More information about the pve-devel
mailing list