The ModMyTM Family of Sites:
ModMyiModMyMobile





 
 

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  ModMyi Forums > iPhone Forums > iPhone Modding > File Mods
Reply
 
LinkBack (2) Thread Tools Display Modes
  2 links from elsewhere to this Post. Click to view. #1  
Old 07-15-2008, 11:54 AM
What's Jailbreak?
 
Join Date: Apr 2008
Posts: 9
Thanks: 1
Thanked 13 Times in 1 Post
HOW TO: iPhone Data Recovery

Recently, I bricked my iPhone and had to restore it in iTunes. In the process, I lost a bunch of photos from my Camera Roll that hadn't been saved to my computer yet. After an endless amount of Google searching, I finally found a way to recover, or "undelete" data from the iPhone. This guide will focus on recovering photos, since that's what I had to do, but the same process could be used to recover other lost data.

What you'll need:
- Jailbroken iPhone
- BSD Subsystem and OpenSSH installed on your iPhone
- Terminal (or MobileTerminal) installed on your iPhone
- An SSH server installed on your computer (mine is running Ubuntu 7.10 with OpenSSH)
- The 'DD' utility installed on your computer (this should be pre-installed on most Linux systems)
- Your iPhone's IP address
- Your computer's IP address

First, make sure that your iPhone and computer are on the same LAN. You can try to ping your computer from your iPhone (using Terminal) and vice versa, just to make sure they can see each other on your LAN. For example:
Code:
ping 192.168.1.215
Next, you'll want to make sure that you can SSH into your computer from the iPhone. To do that, open Terminal on the iPhone and enter:
Code:
ssh <username>@<computer-ip>
Where:
<username> = Your user name on the computer.
<computer-ip> = Your computer's IP address on the LAN.

If that worked, you should be prompted to enter a password for <username>. If the connection times out, then you need to make sure that you have the SSH server running on your computer and make sure that port 22 (the default SSH port) isn't being blocked by your router's firewall.

Once you know that your iPhone and the computer are talking to each other, open Terminal on the iPhone and run the following command to begin transferring the iPhone's "disk" image to your computer (be sure to run this as root using 'su'):
NOTE: Make certain that your iPhone's screen lock is disabled first. If the screen lock comes on, it will kill the SSH connection. Also, you'll want to connect your iPhone to its charger. This transfer can take a while.
Code:
dd if=/dev/disk0 | ssh <username>@<computer-ip> 'dd of=iphone-dump.img'
The above command will create a "disk" image of your iPhone (named "iphone-dump.img") on your computer. Feel free to use a different name or a different destination directory. For example: 'dd of=/home/username/iphone-dump.img'.

Also, be sure that you don't mix up the "if" (input-file) and "of" (output-file) in the command above. Doing so could wipe-out your iPhone.

After the process has completed and the iPhone's image file has been saved to your computer, you can use a program like PhotoRec to recover your photos.

I hope this helps!

Last edited by lmarr28; 08-08-2008 at 09:27 AM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
The Following 13 Users Say Thank You to lmarr28 For This Useful Post:
ajrulez (07-16-2008), army113 (05-08-2010), brinzei (07-31-2008), colouny (11-27-2009), guls_guys (05-15-2010), mungler (03-29-2009), new0rder (06-16-2009), Retell (08-11-2010), rotaryheadrx7 (08-08-2008), Trooper Sam (09-03-2010), VampiraQula (11-30-2009), Vatec (08-26-2010), zdestiny (06-12-2009)

Tag Cloud
  #2  
Old 07-16-2008, 12:02 AM
iPhone? More like MyPhone
 
Join Date: Mar 2008
Device + Firmware: iPhone 1.1.4 (8GB)
Operating System: Vista Ultimate \ Leopard \ Fedora Core
Posts: 195
Thanks: 14
Thanked 19 Times in 15 Posts
Awesome!

Excellent post!

Mods, please make this sticky if possible.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #3  
Old 07-21-2008, 04:57 AM
What's Jailbreak?
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks!!! I'm gonna try it! I just bricked my phone before, so this is helpful, ill let u know if it works
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4  
Old 07-21-2008, 03:18 PM
What's Jailbreak?
 
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I get a dd: opening `/dev/disk0`: Permission denied

Any ideas?

-mike
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #5  
Old 07-22-2008, 10:32 AM
What's Jailbreak?
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Can someone please help with the permission denied error....thanks.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #6  
Old 07-28-2008, 12:50 PM
What's Jailbreak?
 
Join Date: Apr 2008
Posts: 9
Thanks: 1
Thanked 13 Times in 1 Post

Quote:
Originally Posted by msbreton View Post
I get a dd: opening `/dev/disk0`: Permission denied

Any ideas?

-mike
You might have to run the DD command I mentioned above as root on your iPhone. That's what I did and it worked for me (I never tried it without being root though).

To do that, as soon as you open the Terminal app on your iPhone, run the command: su

You should be asked to enter a password. The password should be: alpine

If that worked, try running the DD command again and see if you still get the permission denied error. If it didn't accept the password, you may need to install the "BSD Subsystem 2.x SU Replacement". (The su command that came with BSD Subsystem 2.0 and 2.1 was broken -- this fixes it.)

To install it, add the following source to your installer app:
http://iphone.lenlolabs.com

Hope this helps!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #7  
Old 08-01-2008, 02:44 PM
What's Jailbreak?
 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Cydia

So I made it through most of the steps, got my computer and iphone (1.1.4 ziphone) to connect, got past the "permission denied" error, but then I get a "dd: not found" error.

I believe this is because I have Cydia instead of the BSD Subsytem, and it probably doesn't have the dd utility.

So, what do you guys suggest? Uninstall Cydia?

I'm also wondering if syncing will cause me to lose any potentially recoverable data.

Quote:
Originally Posted by Shasha04 View Post
So I made it through most of the steps, got my computer and iphone (1.1.4 ziphone) to connect, got past the "permission denied" error, but then I get a "dd: not found" error.

I believe this is because I have Cydia instead of the BSD Subsytem, and it probably doesn't have the dd utility.

So, what do you guys suggest? Uninstall Cydia?

I'm also wondering if syncing will cause me to lose any potentially recoverable data.
Ok, so I do have the dd utility. I realized that I couldn't be getting a "permission denied" error without it. I also noticed I have internal help files for that command.

So, my problem is: I type in the command. I get some scrolling stuff and a password prompt for my pc. I type in that password, more stuff scrolls, and then I get an error that says "dd: not found"

What the hell is not found??

Last edited by Shasha04; 08-01-2008 at 02:44 PM.. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #8  
Old 08-01-2008, 02:46 PM
What's Jailbreak?
 
Join Date: Apr 2008
Posts: 9
Thanks: 1
Thanked 13 Times in 1 Post

I'm not familiar with Cydia, since I've never used it, but I can tell you that you will need the BSD Subsystem installed for it to work.

When you delete something from your iPhone (or in this case, when you do a "restore" in iTunes), it's not actually removed from the flash memory... The data is still there, it's just been "flagged" so the OS knows that it's OK to overwrite that section of memory. So, anything you do on the iPhone could potentially overwrite some of that recoverable data (e.g. syncing, taking photos, saving notes, etc.).

Quote:
Originally Posted by Shasha04 View Post
So, my problem is: I type in the command. I get some scrolling stuff and a password prompt for my pc. I type in that password, more stuff scrolls, and then I get an error that says "dd: not found"

What the hell is not found??
Ahh... I completely forgot about that. You'll need DD on your computer as well, since the command that you're running uses DD on the PC-end to create the image file. I didn't mention it before because DD comes pre-packaged with most Linux distros.

Last edited by lmarr28; 08-01-2008 at 02:55 PM.. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #9  
Old 08-01-2008, 04:10 PM
What's Jailbreak?
 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Alright, I figured out my problem and wanted to post it here for the next person to run across it.

I was using OpenSSH for Windows. Windows does not have dd. To use dd, you need on both machines (your phone and the machine you are sshing into), so my error was that dd was not found on my Windows machine.

So, Windows people, either throw in a Knoppix disk, or find a friend who will let you ssh into their unix box like I did

Anyone got stats on how long this transfer will take?

Quote:
Originally Posted by Shasha04 View Post
So I made it through most of the steps, got my computer and iphone (1.1.4 ziphone) to connect, got past the "permission denied" error, but then I get a "dd: not found" error.

I believe this is because I have Cydia instead of the BSD Subsytem, and it probably doesn't have the dd utility.

So, what do you guys suggest? Uninstall Cydia?

I'm also wondering if syncing will cause me to lose any potentially recoverable data.



Ok, so I do have the dd utility. I realized that I couldn't be getting a "permission denied" error without it. I also noticed I have internal help files for that command.

So, my problem is: I type in the command. I get some scrolling stuff and a password prompt for my pc. I type in that password, more stuff scrolls, and then I get an error that says "dd: not found"

What the hell is not found??
Cool, yeah, I figured that out before I saw your reply. FYI, Cydia is an opensource alternative to BSD Subsystem and Installer.app. It has all the BSD Subsystem tools packaged in it, plus others, and leans more to the development community in terms of Unix utilities that have been ported over. It even has color highlighting vim.

So for the record, this method does indeed work with Cydia.

And yeah, I had a feeling syncing might be the moment when stuff gets literally deleted.

Quote:
Originally Posted by lmarr28 View Post
I'm not familiar with Cydia, since I've never used it, but I can tell you that you will need the BSD Subsystem installed for it to work.

When you delete something from your iPhone (or in this case, when you do a "restore" in iTunes), it's not actually removed from the flash memory... The data is still there, it's just been "flagged" so the OS knows that it's OK to overwrite that section of memory. So, anything you do on the iPhone could potentially overwrite some of that recoverable data (e.g. syncing, taking photos, saving notes, etc.).



Ahh... I completely forgot about that. You'll need DD on your computer as well, since the command that you're running uses DD on the PC-end to create the image file. I didn't mention it before because DD comes pre-packaged with most Linux distros.

Last edited by Shasha04; 08-01-2008 at 04:10 PM.. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #10  
Old 08-03-2008, 02:44 AM
What's Jailbreak?
 
Join Date: Aug 2008
Operating System: OSX and XP
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post

Thanks Imarr28 for a great guide. I have got an image off my 16G iphone. Could you explain how to mount the image? I thought I could mount it as:

#mount -o loop iphone-dump.img

but it errors with "you must specify the filesystem type"
I've tried this under linux and under OSX...just can't mount the image.
Any help would be appreciated.
cheers
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #11  
Old 08-05-2008, 09:39 AM
What's Jailbreak?
 
Join Date: Apr 2008
Posts: 9
Thanks: 1
Thanked 13 Times in 1 Post

Quote:
Originally Posted by Shasha04 View Post
Anyone got stats on how long this transfer will take?

...

And yeah, I had a feeling syncing might be the moment when stuff gets literally deleted.
Don't sweat the syncing stuff. I literally went about two weeks after restoring my bricked iPhone before I did this recovery procedure and I was still able to recover about 90% of my lost photos. During those two weeks before doing the restore, I was using my iPhone as normal (syncing, taking photos, etc.). So there's still a chance that you can get a lot of your data back.

As for the transfer time, it took me about 3.5 hours for an 8 GB iPhone. I wasn't very close to my wireless router though, so that could have had an effect on the transfer speed.

Quote:
Originally Posted by scroll1 View Post
Thanks Imarr28 for a great guide. I have got an image off my 16G iphone. Could you explain how to mount the image? I thought I could mount it as:

#mount -o loop iphone-dump.img

but it errors with "you must specify the filesystem type"
I've tried this under linux and under OSX...just can't mount the image.
Any help would be appreciated.
cheers
I wish I could help you here, but unfortunately I'm really not familiar with Linux/Unix/OSX at all. I'm sure there is someone around here who can tell you though.

Just out of curiosity, why do you need to mount the image? If you're using PhotoRec for your recovery, you can just point it directly at the image file by using the file's name as a parameter at the command line. For example, run: "photorec iphone-dump.img"

Last edited by lmarr28; 08-05-2008 at 09:39 AM.. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #12  
Old 08-06-2008, 02:18 AM
What's Jailbreak?
 
Join Date: Aug 2008
Operating System: OSX and XP
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post

Thanks again Imarr28, I didn't realise that photorec could read directly the .img file. I have got nearly all my pictures back from a 16G iphone. It took awhile to download the image ( I left it going over night) but photorec did the restore very, very quickly...I'm impressed.
thanks again.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #13  
Old 08-06-2008, 09:02 AM
What's Jailbreak?
 
Join Date: Apr 2008
Posts: 9
Thanks: 1
Thanked 13 Times in 1 Post

Quote:
Originally Posted by scroll1 View Post
Thanks again Imarr28, I didn't realise that photorec could read directly the .img file. I have got nearly all my pictures back from a 16G iphone. It took awhile to download the image ( I left it going over night) but photorec did the restore very, very quickly...I'm impressed.
thanks again.
Awesome! I know first hand how it feels to lose a bunch of your data like that, so I'm glad I could help you get it back!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #14  
Old 08-06-2008, 03:33 PM
What's Jailbreak?
 
Join Date: Aug 2008
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Help

Quote:
Originally Posted by lmarr28 View Post
Recently, I bricked my iPhone and had to restore it in iTunes. In the process, I lost a bunch of photos from my Camera Roll that hadn't been saved to my computer yet. After an endless amount of Google searching, I finally found a way to recover, or "undelete" data from the iPhone. This guide will focus on recovering photos, since that's what I had to do, but the same process could be used to recover other lost data.

What you'll need:
- Jailbroken iPhone
- BSD Subsystem and OpenSSH installed on your iPhone
- Terminal (or MobileTerminal) installed on your iPhone
- An SSH server installed on your computer (mine is running Ubuntu 7.10 with OpenSSH)
- Your iPhone's IP address
- Your computer's IP address

First, make sure that your iPhone and computer are on the same LAN. You can try to ping your computer from your iPhone (using Terminal) and vice versa, just to make sure they can see each other on your LAN. For example:
Code:
ping 192.168.1.215
Next, you'll want to make sure that you can SSH into your computer from the iPhone. To do that, open Terminal on the iPhone and enter:
Code:
ssh <username>@<computer-ip>
Where:
<username> = Your user name on the computer.
<computer-ip> = Your computer's IP address on the LAN.

If that worked, you should be prompted to enter a password for <username>. If the connection times out, then you need to make sure that you have the SSH server running on your computer and make sure that port 22 (the default SSH port) isn't being blocked by your router's firewall.

Once you know that your iPhone and the computer are talking to each other, open Terminal on the iPhone and run the following command to begin transferring the iPhone's "disk" image to your computer:
NOTE: Make certain that your iPhone's screen lock is disabled first. If the screen lock comes on, it will kill the SSH connection. Also, you'll want to connect your iPhone to its charger. This transfer can take a while.
Code:
dd if=/dev/disk0 | ssh <username>@<computer-ip> 'dd of=iphone-dump.img'
The above command will create a "disk" image of your iPhone (named "iphone-dump.img") on your computer. Feel free to use a different name or a different destination directory. For example: 'dd of=/home/username/iphone-dump.img'.

Also, be sure that you don't mix up the "if" (input-file) and "of" (output-file) in the command above. Doing so could wipe-out your iPhone.

After the process has completed and the iPhone's image file has been saved to your computer, you can use a program like PhotoRec to recover your photos.

I hope this helps!
Could you tell me how can I do?
I'm on G5 with Leopard (no airport card installed) connected via ethernet to an airport extreme. Can I connect to the G5 from iPhone to save the disk image? Is there any way?
thank you

Last edited by flager; 08-06-2008 at 03:36 PM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #15  
Old 08-07-2008, 01:32 AM
What's Jailbreak?
 
Join Date: Aug 2008
Operating System: OSX and XP
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post

flager,
I'm running Leopard also, but on an intel iMac, with a wireless router attached. As long as you know the ip address of the G5 and as long as you have ssh enabled both on the iphone and G5 and as long as you have a terminal program on the iphone you can do it.
Worked for me and I have retreived nearly all my pictures, even after reinstalling firmware on the iphone.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  ModMyi Forums > iPhone Forums > iPhone Modding > File Mods

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


LinkBacks (?)
LinkBack to this Thread: http://modmyi.com/forums/file-mods/237321-how-iphone-data-recovery.html
Posted By For Type Date
iPhone stuck on geohot face - SiNfuL iPhone This thread Refback 07-21-2010 09:24 AM
iPhone data recovery : General forum This thread Refback 06-25-2010 02:34 AM


Go to Top
ModMyI

All times are GMT -6. The time now is 01:13 AM. Powered by vBulletin® Version 3.8.6
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0
Owned and Operated by ModMy, LLC Copyright © 2007-10. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / iPad News / iPad Forums / Cydia Hosting /
RSS / Contact Us / / Top