Ubuntu – Is it possible to use DD to obtain splited images from a hard-drive


My piano teacher asked me to record one of his recitals with his iPod (3-4 generation, not so sure) and I did it. While trying to edit it, he accidentaly deleted it, I'm trying to recover.

After some research, I've been able to discover that there's a way to recover it and I've been able to make it work but the iPod had 64 GB and doing it through SSH is deadly slow, in the last two days, the process stopped twice with this error:

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

I believe the probability of this process stoping in the middle is a high, mainly because it's a dd on 64GB through SSH (it seems it's going to take 6-7 days) then I thought about copying little pieces of the iPod's disk at a time and merge them after the process is complete.

Since the beginning, I noticed that the process through SSH is slow, then I have two questions:

  1. Is it possible to make these splitted images from the iPod's hard drive using dd?
  2. Would it be possible to use something else (such as FTP or anything faster than SSH) in order to achieve this?

The title of the question have only one of this questions for the following reason: "I've been able to make it work through SSH, having to wait is not really a problem – the processing stopping all the time is the problem, splitting the image is the objective, but you could also help me to find something that would work a little faster."

Also for the ones who suggest: "Why don't you just plug the iPod in and mount it's disk?" – the answer is: With the small research I did until now, it seems to be impossible, the only viable way I found to do it is with dd + ssh.

3: I've read here that there's a block size, is this related somehow?

Best Answer

You could use 3 options from dd, count, skip and seek like:

dd if=/dev/rdisk0s2s1 of=iphone1.img bs=1M count=1024
dd if=/dev/rdisk0s2s1 skip=1024 of=iphone2.img bs=1M count=1024
dd if=/dev/rdisk0s2s1 skip=2048 of=iphone3.img bs=1M count=1024

And so on. This way it will create several images, with the same size(1024MB).

To restore the from the backup, load the images in order, and use commands like these:

 dd if=iphone1.img of=/somepartition bs=1M conv=sync,noerror
 dd if=iphone2.img of=/somepartition seek=1024 bs=1M conv=sync,noerror
 dd if=iphone3.img of=/somepartition seek=2048 bs=1M conv=sync,noerror
Related Question