Let's say I have serverA with a block device, the contents of which I want to move to serverB's block device via the computer I am working on as a relay. This is very handy with pipes, buffers, dd and similar tools.
In order to monitor the progress and identify any bottlenecks, I like to follow the progress of the individual status output of each command.
Aside from complicating this one-liner by running multiple terminals, backgrounding (&), looping the outputs through FIFOs or the like, is there any way to handily sort the status outputs?
ssh serverA "sudo dd if=/dev/sdc status=progress | mbuffer" | mbuffer | ssh serverB "mbuffer | sudo dd of=/dev/sdc status=progress"
This gives me a single row that rapidly switches between the five different commands' status and also does not clean the row in between. For example alternating between the following (note the '00% full' on the alternate output):
in @ 6137 kiB/s, out @ 6137 kiB/s, 26.3 GiB total, buffer 100% full
30353129472 bytes (30 GB, 28 GiB) copied, 1158 s, 26.2 MB/s00% full
A neat output would keep each command's output consistently on a separate row.
1 Answer 1
pv
can be used to show you the current throughput in a pipeline and can also to the same as mbuffer
with its -B
option (and can also report live how full the buffer is).
It also has a rate-limited mode (-qL
) which you can use to simulate slow readers for testing.
ssh srchost 'sudo pv -cB1G -F "from device:%t: [%b] %r (buffer: %T)" /dev/sdc' |
pv -WcB1G -F "through pipe:%t: [%b] %r (buffer: %T)" |
ssh dsthost 'sudo sh -c '\''
pv -WcB1G -F "received by dst:%t: [%b] %r (buffer: %T)" > /dev/sdc'\'
Using dd
here doesn't make much sense.
You must log in to answer this question.
Explore related questions
See similar questions with these tags.