[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT - Convert output of byte count to GB count?



On Thu, Feb 07, 2013 at 01:26:45PM -0600, Kent West wrote:
>    This is off-topic because it's on OS/X instead of Debian, but you folks
>    are the smartest, so....
>    The GNU dd command, when sent the -USR1 signal, pauses processing long
>    enough to spit out a status line, like so:
> 
> 18335302+0 records in
>         18335302+0 records out 9387674624 bytes (9.4 GB) copied, 34.6279
>         seconds, 271 MB/s
>    But the OS/X version (requiring the -SIGINFO signal instead of -USR1,
>    which kills the process instead of just pausing it), spits out a status
>    line like so:
>    5346+0 records in
>    5346+0 records out
>    5605687296 bytes transferred in 1890.826832 secs (2964675 bytes/sec)
>    The command I'm using to get this status message is:
>    kill -SIGINFO 32816
>    (32816 is the PID of the dd command in this case)
>    Is there any thing I can throw at this command, perhaps a sed or awk
>    command, etc, which would convert the status' bytes output to GB output?

Probably, but see if pv is nicer for your purposes. pv (pipeviewer) will
give you constant status output for data passing through it. For dd,
you'd replace something like

## dd if=/dev/foo of=/dev/bar
with
## dd if=/dev/foo | pv | dd of=/dev/bar

There are options for pv such as naming the progress bar or telling pv
the expected size (so you get a percentage complete) and so on.

Might be useful to you.

Attachment: signature.asc
Description: Digital signature


Reply to: