Recover deleted files from the internal memory of your Android device

Lord777

Professional
Messages
2,583
Reputation
15
Reaction score
1,296
Points
113
Today we will talk about recovering deleted data from the internal memory of your smartphone.
Important: You need root and usb debugging is enabled.

The bottom line is that any files from the hard disk (flash drive) can be restored using various programs (R-studio, HandyRecovery, Recuva, etc.), even if they were deleted.
But, there is one but. To perform this action, it is necessary that these programs can determine the storage medium from which recovery will be performed as a hard disk or flash drive, since when the device is normally connected to a PC, it is defined as a "Portable Device brandname" or the like.

Simply put, the phone's internal memory is hidden from data recovery programs.
So, in order to work with internal memory, it must be converted to a regular hard disk partition.
You can't just do this, so you need to copy a certain block of memory from your device to your computer and then convert it to the desired format.

To complete the work, we will need:

1. The device to be manipulated.

2. USB data cable.

3. A computer running Windows OS (preferably not lower than "7ki").

4. Beer(optional).

Instructions:

1. In the device settings, in the "Settings=> Accessibility =>>For Developers" tab, activate USB debugging. Install the ADB driver on your computer.

2. Install ROOT-rights on the device (how to do this, you can read on 4pda.ru in the profile theme of your device) ), as well as ClockworkMod recovery, also known as CWM. How to do this, we read on 4pda, for each device the requirements and instructions are different.

3. Install the BusyBox program from the Play Store ( https://play.google.com/store/apps/details?...ericson.busybox ). Log in to this program, grant it super-user rights, and click install. At the same time, it is important that install is made to the system\bin directory, it is specified by default, approximately in the middle of the program screen.

4. Install Cygwin on your PC (the software allows you to use Linux commands in a WINDOWS environment) http://www.cygwin.com/ . Go to the site and click on the setup link.exe, then the download will start. Start the installation, select install from internet. Installation Folder C:\cygwin. Next, select the folder (you can choose any one) to which the cygwin component packages will be downloaded during installation. Next, click Direct Connection. Next, select the site from which the packages will be downloaded(it doesn't matter there). Next, the list of packages itself appears, in which you must select the following items::
- in the Devel item, all sub-items whose names start with the letters gcc (they go in a row)
- in the Debug sub-item pv-debugininfo
- in the Utils sub-item pv

5. Download the Cygwin add - on called Netcat http://www.daemon.de/Netcat. You need to download a zip archive. After unpacking it, move all files to the C directory.:\cygwin. The main thing is that the file located in the archive, in the bin folder, is nc.exe copied to the C folder:\cygwin\bin. The rest of the files located in the root of the archive, as I understand it, can simply be copied to the C folder.:\cygwin (they may not be needed at all).

6. Next, download ADB. Unpack the archive and copy all files from it to the C folder:\cygwin\bin

7. In the C folder:\cygwin create a folder with any name. For example, let's call it " MyPhone"

8. Download the file VHDtool.exe (this is a program that will create a format from the block copied from the tablet, which will later be mounted as a virtual disk and used by file recovery programs). Copy it to the C folder:\cygwin\MyPhone.

9. Now we need to understand which block should be copied to the computer, since there are several of them in the internal memory of the tablet (I have 11) and each of them contains some piece of information, if we are interested in photos, videos, etc., then we need to know the block that contains the relevant information. To understand which block contains what, read this thread: http://forum.xda-developers.com/showthread.php?p=28115791 (you need to know a little English), but you can not worry, and just choose the largest block. You can find out the block size as follows:
- Start-Run-CMD.EXE.
- Use the commands " cd "(enter the directory) and "cd.." (exit the directory) to enter the directory C:\cygwin\bin to run adb
- Next, enter the commands line by line:
Code:
adb shell
su
find /dev/block/platform/ -name 'mmc*' -exec fdisk -l {} \; > /sdcard/list_of_gnex_partitions.txt

The content of this file will be something like this:
Code:
Disk /dev/block/platform/sdhci-tegra.3/mmcblk0p10: 314 MB, 314572800 bytes
4 heads, 16 sectors/track, 9600 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

Something like this. It is clear that the block size can be distinguishable, this is the norm.

10. Turn off the device and enter the CWM mode. Go to the item "Mounts and Storage" and click mount, the following sections: /system and /data.

11. Go to folder C:\cygwin and run the Cygwin file.bat then enter the following code line by line:
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/mmcblk0

You may need to enter system / xbin/ where: system / bin/, please keep this in mind.

12. And again we go to the folder C:\cygwin and run the Cygwin.bat file again. Another window will appear. There we enter the following code line by line:
Code:
adb forward tcp:5555 tcp:5555
cd /mytab
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw

After entering these commands, we will start mounting the image of this block in *.raw format . Approximately this will take 30-40 minutes, here we will need a pre-stored beer :). Visually, in the command line window, we will contemplate such a kinzo:

bb3ea168bde2214bc9d50.jpg


When finished, in the C folder:\cygwin\myphone the mmcblk0.raw file appears. It should be about the same size as the block itself. At this point, you can disconnect the device from the computer. Next, we will work on the block backup.

13. Close both windows with the Cygwin.bat batch file running. Go to the C folder:\cygwin and run the Cygwin file again.bat and convert the newly copied block using the VhdTool program. To do this, register in the console:
Code:
VhdTool.exe /convert mmcblk0.raw

As a result (after 3-4 minutes), the message should appear: Status: Complete. However, the file name itself will not change. The file will still be called mmcblk0. raw, but due to its modification, we will be able to connect it to the computer as a virtual disk.
We make a copy just in case, there aren't many copies.

14. Right-click on the my computer icon and select Manage. In the window that appears, on the left, go to the Storage Devices section, and then go to Disk Management. In the top menu, select Action and select Attach a virtual hard disk. In the window that opens, under file type (where it says Virtual Disk files (*.vhd)), select All files. After that, we select the file that we stole from the tablet, that is, mmcblk0. raw.

15. After that, a new disk will appear at the bottom of the window. To the right of this label will be written Not distributed. Right-click on the name of our disk and select Initialize disk. Next, put a check mark on the item Table with GUID section.

16. Right-click on the label Not distributed and select Create a simple volume…In the following windows, we will assign a letter name to the volume and refuse formatting by unchecking the corresponding box.

17. After clicking the Done button, a new Local disk will appear in the system (the letter that you assigned) and a window will immediately pop up offering to format it again. We agree to this offer and format the disk, while specifying the Fat32 file system, the standard cluster size, and be sure to check the box under Quick formatting.

18. That's it, the disk is now ready to work with data recovery programs. For recovery, you can use PhotoRec (a pretty good console utility) or other analogs(Recuva, R-Studio).

I hope it was interesting and useful, have a good day to all.
 
Top