Maybe this will sound like dumb question but the way i'm trying to do it doesn't work.
I'm on livecd, drive is unmounted, etc.
When i do backup this way
sudo dd if=/dev/sda2 of=/media/disk/sda2-backup-10august09.ext3 bs=64k
…normally it would work but i don't have enough space on external hd i'm copying to (it ALMOST fits into it). So I wanted to compress this way
sudo dd if=/dev/sda2 | gzip > /media/disk/sda2-backup-10august09.gz
…but i got permissions denied. I don't understand.
Best Answer
Do you have access to the sda2-backup...gz file? Sudo only works with the command after it, and doesn't apply to the redirection. If you want it to apply to the redirection, then run the shell as root so all the children process are root as well:
Alternatively, you could mount the disk with the uid / gid mount options (assuming ext3) so you have write permissions as whatever user you are. Or, use root to create a folder in /media/disk which you have permissions for.
Other Information that might help you:
of
instead ofif
and you end up overwriting what you are trying to backup!! Notice how the keyso
andi
are next to each other? So be very very very careful.