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

shreyashirday picture shreyashirday · Nov 12, 2014 · Viewed 7.4k times · Source

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?

Answer

Louay Alakkad picture Louay Alakkad · Dec 6, 2015

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