Hacker News new | past | comments | ask | show | jobs | submit login

You can also drop the `<` in that example, pv takes a file to read from as an argument:

  pv --buffer-size 1m /dev/sda > sda.file
Will do the same thing, and give an accurate % complete progress bar.



> Will do the same thing, and give an accurate % complete progress bar.

I'm not sure that's true, last time I tried to do:

  pv < /dev/zero > /dev/sda
To zero a drive, it correctly printed out the total size of the output block device. Perhaps it also does this type of scanning on stdin, if possible.

That said, looking at the main page, it appears that this functionality is only available for the output end:

Note that if the input size cannot be calculated, and the output is a block device, then the size of the block device will be used and pv will automatically stop at that size as if -S had been given. (http://www.ivarch.com/programs/quickref/pv.shtml)


Ah, I see what you mean, I was thinking in terms of images/files.

As an arguement it gives % of the input (64GB usb drive, 8GB image):

  > pv /mnt/str/Downloads/stick-8g.img > /dev/sdi
  916MiB 0:00:35 [1.88MiB/s] [========>                                                                           ] 11% ETA 0:04:17
Otherwise it seems to give the size of the output if it's a block device.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: