How can I recover a deleted file on Android? I just deleted a file on my Nexus S that I really need back. (It was actually part of an app using a sqlite database that did a drop table when upgrading to a new version.)

Presumably I need to root the phone first (which I hear is easy on Nexus phones) but am I in a catch-22 here? Namely, does rooting the phone mean wiping/overwriting the partition where the data lives?

If not, what do you recommend for data recovery tools? Presumably the file was just unlinked and not actively overwritten (per usual when "deleting" a file) so technically the data must be there...
Manual way

Luckily data recovery on Android isn't different from any other PC/Linux with a flash storage device. You first need root and the dd binary on your device to make a full backup of the block storage device your deleted file was on. dd is sometimes already installed in your system.

Then it's just 3-steps to find out if the file could be recovered:


Find out on which block device the file was on. Via mount
Acquire and image of that block device with dd: dd if=/dev/&lt;blockdevice&gt; of=/sdcard/image bs=4096
Get a data recovery forensics tool and let it search /sdcard/image for the lost file. You can of course try to run multiple tools on the image. Foremost and Scalpel are a good start.


"Undelete" App

There is a new App called "Undelete Beta" which can recover files on the internal storage and the SD card. The App is beta and has some restrictions.

If the file is really important, I would always choose the "Manual Way".