dd supports a 'status' flag, which enables it to show the copied bytes,
duration, and the transfer rate, which then get printed to stderr.

Signed-off-by: Leo Nunner <l.nun...@proxmox.com>
---
 PVE/Storage/LVMPlugin.pm | 2 +-
 PVE/Storage/Plugin.pm    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index a706e0c..4b951e7 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -645,7 +645,7 @@ sub volume_export {
        $size = int($1);
     });
     PVE::Storage::Plugin::write_common_header($fh, $size);
-    run_command(['dd', "if=$file", "bs=64k"], output => '>&'.fileno($fh));
+    run_command(['dd', "if=$file", "bs=64k", "status=progress"], output => 
'>&'.fileno($fh));
 }
 
 sub volume_import_formats {
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 8a41df1..e35fa97 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -1496,7 +1496,7 @@ sub volume_export {
            goto unsupported if $with_snapshots || $file_format eq 'subvol';
            write_common_header($fh, $size);
            if ($file_format eq 'raw') {
-               run_command(['dd', "if=$file", "bs=4k"], output => 
'>&'.fileno($fh));
+               run_command(['dd', "if=$file", "bs=4k", "status=progress"], 
output => '>&'.fileno($fh));
            } else {
                run_command(['qemu-img', 'convert', '-f', $file_format, '-O', 
'raw', $file, '/dev/stdout'],
                            output => '>&'.fileno($fh));
@@ -1506,7 +1506,7 @@ sub volume_export {
            my $data_format = $1;
            goto unsupported if !$with_snapshots || $file_format ne 
$data_format;
            write_common_header($fh, $size);
-           run_command(['dd', "if=$file", "bs=4k"], output => 
'>&'.fileno($fh));
+           run_command(['dd', "if=$file", "bs=4k", "status=progress"], output 
=> '>&'.fileno($fh));
            return;
        } elsif ($format eq 'tar+size') {
            goto unsupported if $file_format ne 'subvol';
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to