Recover Deleted Files

Recover Deleted Files
Trash_Can_Full.png

You lost your files or photos accidentally on your android phone or tablet. You might have deleted them or formatted or reset your android device to factory settings. You might have unlocked BootLoader that could have erased android data. Can you recover deleted photos or documents from android smart phone or tablet?

Your deleted photos or data might be on the android phone internal memory or sd card. It is mostly straight forward to recover lost data if you had data on the sd card. This would be same as restoring from laptop hard drive. One of the things you need to do remember when you try to recover lost data is you should not create or copy new data on to android device, this might overwrite your lost data. Also, you need to recover data to separate drive or location if possible.

USING APPS
There are more than couple of android apps you can try to recover your lost data like videos, photos, files etc. Most of these apps require your android device be rooted.
Hexamob Recovery Lite supports vfat, ext2, ext3, ext4 type of files. This android app requires your android device be rooted. You need to use proversion which uses Total Recovery for recovering deleted files for Samsung Galaxy Nexus phones. You can recover any type of data using this android app.

Hexamob.png


Undelete for Root Users is free android to recover deleted android files from internal memory or sd card. It supports FAT format only. You can recover image files with free app. If you need to recover other file types, you need to buy Undelete Key.

Undelete.png


Disk Digger android app lets you recover deleted photos or images from android internal storage or sd card. You can even email restored photos. This app also requires root access. You can recover pics even if you reformatted memory card.

Dagger.png


Bonus tip, you can use Dumpster Recycle Bin android app to have recycle bin on your phone or tablet. All the deleted files go into recycle bin same as your computer recycle bin. You can restore audio, video, image files, contacts, sms text messages directly from recycle bin. You don’t need to root your android device to use this app.

USING DESKTOP SOFTWARE
If your lost data is on sd card, you can regular desktop software to recover deleted files. Just insert sd card into your computer or laptop. It shows up as a drive. You can scan sd card to undelete the files. You can use this same technique for recovering files from camera sd card, camcorder sd card, mp3 players or any other sd card or usb drive etc.
Wondershare Data Recovery for Android can recover any type of file including photos, videos, audio, pdf files, documents etc. You need to install this software on computer and connect your android phone to computer to scan for deleted files in phone sd card.

wdr.png


Recuva is a file recovery software. This software is made by same people who made popular CCleaner software. It works on most Windows OSes including Windows 8, Windows 7. You can even use it to damaged or formatted disks or sd cards.

recuva.png

USING MANUAL METHOD
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, cry no more cream-puff!
The Process
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. Make sure to open Cygwin once to make sure that the /bin folder is created. Also, I made a folder at [c:\cygwin\nexus] to put the exported .RAW file,
  • Netcat (download the ZIP file and extract nc.exe to [c:\cygwin\bin]),
  • ADB (make sure adb.exe is in your path),
  • USB Debugging enabled on your device,
  • VHD tool from the mighty M$. Put the VhdTool.exe file in [c:\cygwin\nexus],
  • 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...
The Work
1. Identify which block/partition you want to recover. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p12
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]):

adb forward tcp:5555 tcp:5555
adb shell
su
/system/bin/BusyBox nc -l -p 5555 -e /system/bin/BusyBox dd if=/dev/block/mmcblk0p12

6. Open another Cygwin terminal and enter:

adb forward tcp:5555 tcp:5555
cd /nexus (name of the destination dir)
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw

7. Run around the house a few times. For 32GB internal memory this is going to take 3+ hours. That's a lot of running. When it's done...
8. 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\nexus], and type:

VhdTool.exe /convert mmcblk0p12.raw

9. Now we need to mount the VHD in Windows. Select the Start button-->right-click Computer-->select Manage.
10. Select Storage-->Disk Management.
11. In the menu select Action-->Attach VHD.
12. For Location enter [c:\cygwin\nexus\mmcblk0p12.raw] and select the OK button.
13. Right-click on the name (e.g. "Disk 1") to the left of the Unallocated space and select Initialize Disk.
14. Select the GPT (GUID Partition Table) radio button and select the OK button.
15. Right-click on the Unallocated space and select New Simple Volume...
16. 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.
17. A box will pop up asking you to format the drive. You DO NOT want to format the drive at this time.
18. 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.
19. 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!)
20. 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.
21. 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.
22. Profit!

credits for the manual method to Wartickler (xda)
by arawn
Feb 7, 2013