Ubuntu: pv permission denied, but dd works without error [duplicate]


This question already has an answer here:

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.


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »