How to use PipeViewer(pv) on Mac OS with dd

8.6k views Asked by At

I'm trying to copy a .img of Ubuntu 14.04.1 to my bootable usb using the command sudo dd if=~/Documents/targetUbuntu.img of=/dev/rdisk1 bs=1m but it's taking long and I can't see the progress. So i'm trying to use pv using this command sudo dd if=~/Documents/targetUbuntu.img | pv | dd of=/dev/rdisk1 bs=1m but im getting this error: dd: /dev/rdisk1: Permission denied. If I do do ctrl-C in the first scenario where its taking too long it tells me that it copied over X amount of bytes in X secs and that's it. When I try to boot the usb, it says "isolinux.iso is missing or corrupt". So I want to make sure that file is copying over properly and I want to do that by using pv to check the progress, but I keep getting that error. Any solutions?

2

There are 2 answers

0
Maks On BEST ANSWER

I suspect its because the sudo is only being used for the first command in your pipe, where you are using dd to read the image file. See this answer over on the unix SE

Or you can try instead something like: sudo "pv -tpreb myubuntu.img | dd of=/dev/sdc

per post by Greg Kroah-Hartman on g+

0
Louay Alakkad On

Add sudo to the second "dd" command instead.

dd if=~/Documents/targetUbuntu.img | pv | sudo dd of=/dev/rdisk1 bs=1m

You'll also want to provide "size" to pv command (replace 123456 with file size.)

dd if=~/Documents/targetUbuntu.img | pv -s 123456 | sudo dd of=/dev/rdisk1 bs=1m