Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to do this, I'm sure you don't wanna read all that then I'll make a resume on it: A file was accidentally deleted on a iPod4, I need to recover it and I've been able to do all the process through SSH and DD.

I was using this command:

root@g1:/home/gustav# ssh root@ dd if=/dev/rdisk0s2s1 bs=1M | dd of=iphone-use2.img
root@'s password: 
Write failed: Broken pipe
4113088+0 records in
4113088+0 records out
2105901056 bytes (2.1 GB) copied, 51107.2 s, 41.2 kB/s

And then I was having this error - I had the error twice, the first time I had it I could make a ISO file of ~11GB, the second time I've made a file of ~2GB. I presume the dd process can stop due to unknown reasons then I had the idea of using the DD to make splits of the iPod's harddrive.

Then I've started to use these commands:

ssh root@ dd if=/dev/rdisk0s2s1 of=iphone1.img bs=1M count=1024
ssh root@ dd if=/dev/rdisk0s2s1 skip=1024 of=iphone1.img bs=1M count=1024

The problem now is: When I was using the first command, the DD was copying the ISO file to my computer, with this second command it's copying the ISO file to the iPod's harddrive, how can I specify where the output file is going? I want it copied to my computer, I'm aware that it may involve some alteration on the of argument but I don't know how to do it, can you help me?

Also, why the first command make a copy of the iPod's disk to my computer drive and the second make a copy of my iPod's disk to itself, if the of argument is similar on both?

share|improve this question
up vote 3 down vote accepted

Seems like your SSH session is cutting out. I've expirienced a similar problem in a different situation. Try adding this line to your /etc/ssh/ssh_config file on your PC:

ServerAliveInterval 120

Give it a try and see if that prevents your Broken Pipe errors.

As for your command your missing something. It should be:

ssh root@ dd if=/dev/rdisk0s2s1 bs=1M count=1024 | dd of=iphone1.img

You forgot to pipe the dd output to your PC.

share|improve this answer
This won't solve the problem, even doing that I can have problems with router, power, etc. I need to find a definitive way for doing it, and I guess this way is through the splitted images. – Voyska Dec 3 '12 at 5:03
@GustavoBandeira WiFi reliability isn't a real problem. Hasn't ever stopped me from copying large files between devices before. Anyway I've addressed your dd issue as well. Check my edited Answer. – japzone Dec 3 '12 at 5:10
Yeah, but here the power is a little unstable. The | means "pipe out of the device"? – Voyska Dec 3 '12 at 5:13
The | symbol means "pipe output of this to input of that" so basically the command is this: "ssh connect to iPod, use dd to read /dev/rdisk0s2s1, pipe output of ssh command(reading of disk) to dd and write data to file 'iphone1.img'" – japzone Dec 3 '12 at 5:20
Everybody has lapses :) – japzone Dec 3 '12 at 5:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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