`pv` rates (was: burn iso to usb)

2021-08-02 Thread Stefan Monnier
Anssi Saari [2021-08-02 19:04:59] wrote:
> David Wright  writes:
>> On Mon 02 Aug 2021 at 16:14:15 (+0300), Anssi Saari wrote:
>>> Stefan Monnier  writes:
>>> >>> > cp /path/to/file.iso /dev/sdX
>>> >>> dd if=whatever.iso of=/dev/sdX  
>>> >> It's up to taste.
>>> >
>>> > Not at all.  The only right answer is:
>>> >
>>> > pv -parIe /dev/sdX
>>> 
>>> Actually I'm not sure how good it is to have both -a and -r, pv doesn't
>>> really show which rate counter is which...
>>
>> No need: the rate is far more variable than its average, as time passes.
>
> I guess it depends. Before that comment I tried it on an old USB
> stick. Read speed was pretty much constant if low. So I think it was the
> left rate counter that showed current rate but wouldn't bet on it.

[ I'm glad my silly intervention brings up a more constructive
  discussion ;-)  ]

If they're both pretty much constant, they're presumably both pretty
much equal, so it doesn't matter which is which ;-)

But indeed, it's not always the case.  I'm right now using `pv` to read
data off of a broken drive (a 2TB 2½" drive which apparently has
problems seeking, resulting in a transfer rate of about 45kB/s), and
it's currently showing me 45.0KiB/s and 70.6KiB/s both of which are
quite stable.  If it weren't for the first sometimes changing to
44.xKiB/s it'd be hard to know which is which (IIUC the average is
higher because occasionally the drive gives a more reasonable transfer
rate than that measly 45kB/s).


Stefan



Re: `pv` rates (was: burn iso to usb)

2021-08-02 Thread David Wright
On Mon 02 Aug 2021 at 13:26:19 (-0400), Stefan Monnier wrote:
> Anssi Saari [2021-08-02 19:04:59] wrote:
> > David Wright  writes:
> >> On Mon 02 Aug 2021 at 16:14:15 (+0300), Anssi Saari wrote:
> >>> Stefan Monnier  writes:
> >>> >>> > cp /path/to/file.iso /dev/sdX
> >>> >>> dd if=whatever.iso of=/dev/sdX  
> >>> >> It's up to taste.
> >>> >
> >>> > Not at all.  The only right answer is:
> >>> >
> >>> > pv -parIe /dev/sdX
> >>> 
> >>> Actually I'm not sure how good it is to have both -a and -r, pv doesn't
> >>> really show which rate counter is which...
> >>
> >> No need: the rate is far more variable than its average, as time passes.
> >
> > I guess it depends. Before that comment I tried it on an old USB
> > stick. Read speed was pretty much constant if low. So I think it was the
> > left rate counter that showed current rate but wouldn't bet on it.
> 
> [ I'm glad my silly intervention brings up a more constructive
>   discussion ;-)  ]
> 
> If they're both pretty much constant, they're presumably both pretty
> much equal, so it doesn't matter which is which ;-)
> 
> But indeed, it's not always the case.  I'm right now using `pv` to read
> data off of a broken drive (a 2TB 2½" drive which apparently has
> problems seeking, resulting in a transfer rate of about 45kB/s), and
> it's currently showing me 45.0KiB/s and 70.6KiB/s both of which are
> quite stable.

Writing "quite stable" cloaks the information nicely. The average can
never move away from the rate: a change in the least significant digit
gives the game away.

> If it weren't for the first sometimes changing to
> 44.xKiB/s it'd be hard to know which is which (IIUC the average is
> higher because occasionally the drive gives a more reasonable transfer
> rate than that measly 45kB/s).

So now we're left wondering how you came by this situation. Perhaps
you slumped onto the Return key, then woke up after a few minutes,
having missed the initial burst that gave rise to the average being
more than 50% faster than the current rate.

Cheers,
David.