pv permission denied, but dd works without error [duplicate]
Solution 1:
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.