My command which doesn't work:
sudo gzip -dc sda1.image.gz | dd of=/dev/sda1
returns the following error even before I've had a chance to enter my password:
dd: failed to open ‘/dev/sda1’: Permission denied
[sudo] password for ken:
I've also tried without the "-dc" options and get the same error.
However, the dd command without gzip, using an uncompressed file, does work:
sudo dd if=sda1.image of=/dev/sda1
It seems like the sudo is only applying to the first command and not the entire sequence of commands. If I remain in the same terminal session and repeat the command, I don't get the password prompt (my authentication seems to persist) and yet I still get the same error (as if my authentication is not applying to the /dev write operation). The same error occurs when executed from a /bin/sh script.
How should I construct my command(s) to uncompress my image to the device?
I'm using Ubuntu 14.04 LTS in a terminal window.