pv is program running above dd. I am cloning my old HDD onto new SDD I bought. It's 500GB of data. I tried to run the following command to copy sda to sdb:

ubuntu@ubuntu:/$ sudo pv < /dev/sda > /dev/sdb
bash: /dev/sda: Permission denied

Using dd command did not produce this error.

I am running the system Ubuntu from the DVD. sda is the main laptop harddrive connected over SATA, sdb is SSD drive connected over USB using USB-SATA converter.

marked as duplicate by David Foerster, Eric Carvalho, Ravan, Charles Green, muru Dec 16 '15 at 7:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 6 down vote accepted

The redirections above are setup by your shell before forking and execing sudo. You may want something like the following:

sudo bash -c 'pv </dev/sda  >/dev/sdb`

This will cause bash to be run by sudo. Bash will execute the parameter to the -c arg as a command in that shell rather than running interactively.

The dd command worked because presumably you didn't use redirections with it.

Also, pv doesn't run above dd. The pv command does lots of things, including showing progress of its output to stdout or rate limiting its output.

  • Thank you. And can you reassure me that the pv </dev/sda >/dev/sdb copies from sda to sdb? It would be nasty if I got all my sourcecode and personal data accidentally deleted. – Tomáš Zato Dec 11 '15 at 12:47
  • I would look into rsync for that use case. – Wren T. Dec 13 '15 at 19:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.