[GUIDE] Internal Memory Data / Deleted Files Recovery

M S T F

Member
Apr 16, 2013
11
11
0
This is the same tutorial written by Wartickler at this link. Thanks for his efforts, his work is appreciated.:)
Here we bring minor changes to the tutorial for those of you who are facing problems accomplishing the procedures.

The Problem
Internal Memory doesn't mount as a drive like external memory does. External memory would allow you to use data recovery tools that scan for deleted files and return them to a usable state. These tools work because most operating systems don't go through and set all of those 1's and 0's to just 0's when you delete a file. Usually the operating system will just delete the reference pointer in the index that says that a file exists with such-and-such name and it's located at this position on the hard disk / memory location. There are destructive delete tools out there that will overwrite the spot of a deleted file multiple times to discourage recovery in just this manner. The issue is that data recovery tools need an actual mounted drive in order to dig deep and unearth those funny pictures of cats you so tragically deleted by accident. These newest batches of phones don't have external SDcards which are super easy to mount as drives. Internal memory mounts as MTP/PTP which is not treated as a mounted drive and cannot be scanned by these data recovery tools. But still there is a hope.....

The Process
My phone is the Samsung Galaxy s4 (GT-I9500) though I imagine this should work for ANY phone with Internal Memory. We will be using a Windows 7 machine to:
  • back up the entire internal memory partition to your computer as a single, massive .RAW file,
  • convert the .RAW file output to a VHD,
  • mount the VHD as a disk in Disk Manager,
  • scan the attached VHD volume for files that have been deleted and recover them,

The Requirements
  • A rooted Android phone, (try to root with a non-destructive method as this appears to protect those who must root from wiping the device data a second time),
  • BusyBox installed on your device,
  • Cygwin installed to [c:\cygwin] with pv and util-linux from the repo (at the package selection screen search for pv then util-linux and click on Default to change it to Install). Make sure to open Cygwin once to make sure that the /bin folder is created. Also, I made a folder at [c:\cygwin\samsung] to put the exported .RAW file,
  • Netcat (download the ZIP file and extract nc.exe to [c:\cygwin\bin]),
  • ADB - You can use minimal adb and fastboot which is 2MB only. Attached, find the link at the bottom of this post. (make sure adb.exe is in your path. Path is in System Properties -> Advances -> Environment Variables -> System variables -> Path and add to the end: ";C:\Program Files\Android\sdk\platform-tools" or where ever you placed your adb.exe),
  • USB Debugging enabled on your device,
  • VHD tool from the mighty M$. Put the VhdTool.exe file in [c:\cygwin\samsung],
  • Piriform Recuva or your favorite data recovery tool, (it appears Recuva only finds the more common file types like images, videos, etc. Those were the file types in which I was interested. If you are after more exotic file types perhaps you might share the software you used.)
  • A calm sense of peace and serenity that you will get your files back... :fingers-crossed:

The Work
  1. *****Based on the number of people having trouble with this step it is now my recommendation that you choose to recover your entire memory block instead of just the data partition. In my phone's case that is mmcblk0. Please discover if yours is different.
    [*]*****For identifying which block/partition you want to recover, install DiskInfo from Playstore. Open the app and click on Data (USERDATA) to see the partition name for yours. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p21
  2. Turn on your phone
  3. Connect the phone in ADB mode
  4. Unlock the screen.
  5. Open a Cygwin terminal and enter (This assumes your BusyBox installation is at [/system/bin/busybox]. It may be at [/system/xbin/busybox]):
    *Remember to enter codes line-by-line. After you enter su, you have to grant permission on your mobile phone at the same time
    Code:
    adb forward tcp:5555 tcp:5555
    adb shell
    su
    /system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p21
  6. Open another Cygwin terminal and enter:
    Code:
    adb forward tcp:5555 tcp:5555
    cd /samsung
    nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p21.raw
    [*]Depending on the size of partition it may take a while to backup.
  7. We need to convert the .RAW file to a virtual hard drive. VhdTool.exe basically just puts a VHD footer on the end of the .RAW file. Open a Windows command prompt, go to [c:\cygwin\samsung], and type:
    Code:
    VhdTool.exe /convert mmcblk0p21.raw
  8. Now we need to mount the VHD in Windows. Select the Start button-->right-click Computer-->select Manage.
  9. Select Storage-->Disk Management.
  10. In the menu select Action-->Attach VHD.
  11. For Location enter [c:\cygwin\samsung\mmcblk0p21.raw] and select the OK button.
  12. Right-click on the name (e.g. "Disk 1") to the left of the Unallocated space and select Initialize Disk.
  13. Select the GPT (GUID Partition Table) radio button and select the OK button.
  14. Right-click on the Unallocated space and select New Simple Volume...
  15. In the Wizard select Next>, leave the default for the volume size, select Next>, select a drive letter (e.g. K), select Next>, MAKE SURE to select the 'Do not format this volume' radio button, select Next>, select Finish.
  16. A box will pop up asking you to format the drive. You DO NOT want to format the drive at this time.
  17. Right-click on the RAW space and select Format... MAKE SURE to change the File system to FAT32. Set the Allocation unit size dropdown to 'Default.' MAKE SURE that the Perform a quick format checkbox is CHECKED. You do not want to overwrite the entire new drive with all zeroes (0's) and destroy your data. Quick Format means that it will only attempt to destroy the index for the drive by establishing a new index. Without this box checked the Windows operating system will write zeroes (0's) across the entire volume, potentially destroying your data. Select the OK button.
  18. A box will pop up saying that Formatting this volume will erase all data on it. That would be doubly true if you actually didn't check the 'Perform a quick format' checkbox. Double check that you actually did check the box and select the OK button. (Don't worry. This essentially leaves the volume in the exact same state that your phone's internal memory is living in right now: there is data on the drive...you just can't see it. It's coming back, I promise!)
  19. Open the Piriform Recuva application. In the wizard select the 'Next >' button. Select the 'Other' radio button and select Next >. Select the 'In a specific location' radio button and enter: k:\ (assuming K is the drive letter you chose...) Select the Next > button. Select the Enable Deep Scan checkbox. This is the magical setting that finds files that have been deleted...but not really deleted. Select the Start button.
  20. The application may take about an hour to do the 'Deep Scan.' It's time for more laps around the house! Once the application has returned its results you can choose which files to recover using the checkboxes. Select the 'Recover...' button and choose the location to which you wish to output your files.
  21. ?
  22. Profit! :victory:

Good Luck :good:
 

Attachments

Last edited:

Lennyz1988

Senior Member
May 15, 2009
3,274
644
0
Amsterdam
it works with 4.4.x and 5.1.1, it probably also works with 4.3. it's just an adb command after all.
No its not that. As of Android 4.3 Google enabled Trim on our decives. That means when you delete a file its really gone. Not even a professional company can get it back.

I have tried the above methode and I could not get any data back. Thats when I started reading about Google enabling Trim and found out its impossible to get it back.

Did you try it on Android 4.3+?
 
Last edited:

Filoppi

Member
Jun 23, 2013
12
1
0
try

Do you also know that as of Android 4.3 this method doesn't work anymore?
No its not that. As of Android 4.3 Google enabled Trim on our devices. That means when you delete a file its really gone. Not even a professional company can get it back.

I have tried the above method and I could not get any data back. Thats when I started reading about Google enabling Trim and found out its impossible to get it back.

Did you try it on Android 4.3+?
I have tried on my previous Samsung galaxy s3 (i9300) and my one plus one, both 64gb, i got at least 20% of the pictures back (.png, .jpg, ...), possibly even 50% since i had no idea how many i had on the device, some zip, most of .pdf and .doc and some other random stuff.
In both cases i did not manually delete the files from the phone, instead, i screwed up the partitions by deleting some system file, so after restarting, the SDcard/used data partition was empty.
i noticed though that even if my phone only had 500mb of free space available, the .raw partitions i extracted with this method were mostly empty, they only had about 10% of the data, so i guess some happened when android restarted, maybe yeah, some kind of trimming.

i think its worth trying anyway. just remember to not open any program or copy any file in the memory, as it would lower the chances to get anything back.
 

Lennyz1988

Senior Member
May 15, 2009
3,274
644
0
Amsterdam
I have tried on my previous Samsung galaxy s3 (i9300) and my one plus one, both 64gb, i got at least 20% of the pictures back (.png, .jpg, ...), possibly even 50% since i had no idea how many i had on the device, some zip, most of .pdf and .doc and some other random stuff.
In both cases i did not manually delete the files from the phone, instead, i screwed up the partitions by deleting some system file, so after restarting, the SDcard/used data partition was empty.
i noticed though that even if my phone only had 500mb of free space available, the .raw partitions i extracted with this method were mostly empty, they only had about 10% of the data, so i guess some happened when android restarted, maybe yeah, some kind of trimming.

i think its worth trying anyway. just remember to not open any program or copy any file in the memory, as it would lower the chances to get anything back.
Yes but that's something different I think. Then you never deleted the files, they were there but not accessible.

If you look for example in the last 10 pages of the main thread, then no one is able to recover anything. Because it's simple not possible anymore. That's just how Trim works.
 

Filoppi

Member
Jun 23, 2013
12
1
0
Yes but that's something different I think. Then you never deleted the files, they were there but not accessible.

If you look for example in the last 10 pages of the main thread, then no one is able to recover anything. Because it's simple not possible anymore. That's just how Trim works.
I'm sorry for your loss.
 

M S T F

Member
Apr 16, 2013
11
11
0
You should be honest with people. You should put in the op that it will only work on Android versions below 4.3. People are just getting false hope and wasting their time.

This method does NOT work anymore.
This is not my method nor I have, my self said that 100% you will get what you have deleted. I have only brought minor changes to the tutorial for the sake of successful transfer of data to the pc.

Now if you feel responsible for the feeling of people, definitely I will appreciate if you find another way.
 

Lennyz1988

Senior Member
May 15, 2009
3,274
644
0
Amsterdam
This is not my method nor I have, my self said that 100% you will get what you have deleted. I have only brought minor changes to the tutorial for the sake of successful transfer of data to the pc.

Now if you feel responsible for the feeling of people, definitely I will appreciate if you find another way.
That's the thing. You just copy paste a tutorial that does not work. Why would you do that? I can imagine that you did not know that it would not work anymore. But now you do know. What do you hope to achieve? Raising your thanks meter? You give people false hope and you waste their time.

And about me finding another way....There is not even a professional company that can do it. It's impossible at the moment.
 

M S T F

Member
Apr 16, 2013
11
11
0
That's the thing. You just copy paste a tutorial that does not work. Why would you do that? I can imagine that you did not know that it would not work anymore. But now you do know. What do you hope to achieve? Raising your thanks meter? You give people false hope and you waste their time.

And about me finding another way....There is not even a professional company that can do it. It's impossible at the moment.
I don't need thanks... why I should do.... it doesnt give me anything... I have got my own forum with its nice members.... if someone is in need of thanks, thats is you which is trying to show himself as a defender of others feeling, time, blah blah.......

I have recovered my file on a 4.4.2 android after a system crash which I had to reset the phone. if someone is in desperate need of something s/he will try anything and as far as I know trying this one doesn't harm anyone.

for you I have a recommendation, go and drink something cold and calm down!!!
 

exdroid1

Senior Member
Aug 14, 2010
56
3
0
Awesome....the raw extraction worked on my S6 running Android 5.0.2. This time I tried it on a Mac and used Homebrew to install PV. Is there a way to get the entire image, even with the unused space?
 

temtek

New member
Jul 12, 2015
1
0
0
Great

Thank you!

Worked on my sm-g900f

If you get nc/pv command not found , try this:

When you open cygwin terminal, start with this line: export PATH="/cygdrive/c/cygwin/bin";$PATH

The terminal should now know the location of them.

Same if you get that "adb: command not found" just type: export PATH=/cygdrive/c/XXXXX";$PATH

Just replace that XXXXX= to your location of adb.exe.

Hope it helps someone out of this ****
 
Last edited: