[Guide] Recovering Deleted Files

Rukbat

Retired Moderator
Feb 12, 2012
44,529
26
0
Visit site
You turn on your phone, open Gallery to see a picture you took last week and ... Oh, no! There are no pictures! What happened to them? Where did they go?

First, a little lesson on how Android works. When you turn the phone on, or restart it, a system function called Media Scanner runs, listing all the media files on the phone and, if you have one, the external SD card. Videos, music, pictures - any media files. When you run Gallery it looks at that list for picture files, finds each one and displays them. The "album" name the pictures are in is the folder the files are in. If the picture file is on the phone you'll see it in Gallery (or QuickPic, a much better app). There's no "gallery" folder.

So where did your pictures go? They probably got deleted. Now your question is "how do I recover a deleted picture?"

Well ... the first thing is to not to have to. Always back up anything that's important. (See Backing up an Android Phone.) If it's on your computer, and on a cloud account, and it gets deleted from your phone, oh, well. Another minute of your life wasted copying it back to the phone. An old computer saying has it that any file not backed up is a file you don't need. Of course it's the other way around - any file you don't need, you don't back up. But it's true. If it's worth having, it's worth backing up.

There are at least a few dozen free cloud accounts you can get by googling free cloud account. You can probably get a few TB of free space. Many of them have free apps, so you can do the backup right from the phone, out in the middle of I-40 (unless you're in Great Smoky Mountains National Park, also known as Great Smoky Mountains Signal Hole for all Carriers). Take a picture or video, it's great, back it up right then.

So from now on, make sure you back up at least the really important things as soon as possible. (Being a parent, grandparent, uncle, etc., almost makes me want to cry when someone lost the only pictures of their first child's first steps.)

But it's too late now, you didn't back that picture up and it's gone. What do you do? That depends on whether the file was on internal storage or the external SD card.

Internal Storage
Unless you're already set up to recover deleted files, you're probably going to lose at least part of one file. You can not recover a deleted file unless the phone is rooted. Don't look for a "way out", a "back door", you need access to a part of the file system that only the user "root" can access. (But see the last paragraph of this guide. Yes, you still have to be rooted, but it's one of those "whyt didn't I think of that" things. I've used dd many times over the years. It was so obvious once I saw it on the PhotoRec site.) Or, rather, the app you're going to use does. It's called DiskDigger undelete. The free version only recovers pictures. If you want to recover other types of files you need the paid version DiskDigger Pro. It's $3, not much as good apps go. (Install Google Opinion Rewards and you'll make that in a week or two - for spending 30 seconds a few times a week checking multiple choice answers.) (But, again, see that last paragraph.)

When a file gets "deleted", the file doesn't go anywhere - the space it's in gets marked as unused. Anything you save from that point on could get stored where that file was. So rooting the phone and installing DiskDigger could potentially overwrite one or more of the deleted files. (And, if you don't have an HTC phone, rooting the phone voids the warranty. [Evidently HTC doesn't see installing one file and one app as being a serious threat to the phone - and that's all rooting is.])

So, if you're ready to go, root your phone (look on XDA Forums for rooting instructions, files, etc., for your particular model phone if you don't know how to do it). Then go to the Play Store and install DiskDigger. Run it and it'll find lots of deleted files. Tell it to recover the one(s) you want. If you find a picture in which the bottom half, third, some part, is garbage, the space that part of the file was in got used to store another file. There's nothing you can do about that, except maybe edit the picture if the important part is still there.

(But see the last paragraph of this guide.)


External SD Card Storage
This one's easier, because all you have to do to the phone is take the SD card out. Put it into a card reader. This one will do the job, reads SD cards or microSD cards, is USB 3.0 and is only $6.

Now go to PhotoRec. Download the file. Extract the contents into a folder on your hard drive. (Name it PhotoRec if you want your hard drive to make sense to you.) Run photorec (the Windows version is named photorec_win.exe, the ones for other operating systems are similar.) BTW, this is a great improvement over the older version of PhotoRec (which I was running until I downloaded this one in order to write this guide. You used to have to burn PhotoRec to a disk, then start your computer with that disk. Now it's just a program.)

Be careful with 2 things:
1) The drives it's recovering from use the Linux naming convention, so the first drive (drive C in Windows) will normally be /dev/sda, the second one /dev/sdb, etc. Your card reader will be identified on the right end of the line as a media card reader or something to that effect - it won't be a hard drive type name like any others in the list. That's the one you want.

2) You must not recover to the media card reader. If you do, PhotoRec will find a file and write it to unused space on the card - just what you don't want. Recover to your C drive, your D drive, any drive other than the media reader. (Make a temporary folder to put the recovered files in.)

BTW, PhotoRec will recover a load of different file types, not just pictures. Not just file types you've heard of. So don't be surprised if it recovers 32GB of files from a 32GB SD card that's had everything deleted. (There's a list of file types it recovers in the menu when you're running the program You can tell it to not recover certain file types. By default, it recovers anything it knows.)

There's an excellent step by step explanation, with screen shots, of how to use PhotoRec at PhotoRec Step By Step - CGSecurity

CG Security has written a program that's worth a lot. It's free (and open source - if you're a programmer, you can grab the source, help add to it, etc.) Get it. If you can spare it, make a donation. They deserve it. (No, I'm not associated with them in any way. I've just been glad, many times, that I found this program.)

If you have an iPhone, you can even recover the deleted files from the iPhone with it. The main part of the process, dd, is available on a rooted Android phone too (I think it's in Busybox), so following the Recover Data from an iPhone procedure should work on an image file produced by dd on an Android phone as well. If it does, you can use that instead of DiskDigger. Of course the phone has to be rooted and Busybox has to be installed. And dd takes a long time to make an image file, so start it running before you have something to do that's going to take a while, or watching grass grow in the winter will be more lively and exciting.
 
Last edited:

Toeopla

Member
Oct 18, 2015
5
0
0
Visit site
Is there any tool that allows me to recover deleted SMS from my LG G4? The 2 tools seem not to work.
I don’t think installing an app to recover deleted files from Android is a good idea since I heard that the deleted files that are overwritten by data are hard to recover.
 

Ruby Star

New member
Nov 11, 2015
1
0
0
Visit site
I used this app and I even bought the full version to restore my deleted music files but it didn't work , it found some of the songs but they weren't the full songs, they were just 6 seconds long😟 this has also happened with other apps I have used yo restore my files . Can you please help me. I have tried everything but nothing has worked .
 

godach

New member
Aug 18, 2016
1
0
0
Visit site
I accidentally deleted a few month's worth of videos of my baby boy and was desperate for recovering the files. I first tried all those software that claimed to work, of course none of them did, but at least I can use Dr. Fone to root my Note 3 for free, so that's helpful. Then I tried DiskDigger Pro to look for mp4 files. To my dismay, it "recovered" some current mp4 files which probably are still in the internal storage, and gave me a message that 200+ files were not recoverable/corrupted. So I am still desperately looking for a way to retrieve.
 

Golfdriver97

Trusted Member Team Leader
Moderator
Dec 4, 2012
35,358
108
63
Visit site
There are some PC programs that might be able to help. I haven't used any myself, so I can't recommend any offhand.
 

danredon

New member
Feb 13, 2017
1
0
0
Visit site
You turn on your phone, open Gallery to see a picture you took last week and ... Oh, no! There are no pictures! What happened to them? Where did they go?

First, a little lesson on how Android works. When you turn the phone on, or restart it, a system function called Media Scanner runs, listing all the media files on the phone and, if you have one, the external SD card. Videos, music, pictures - any media files. When you run Gallery it looks at that list for picture files, finds each one and displays them. The "album" name the pictures are in is the folder the files are in. If the picture file is on the phone you'll see it in Gallery (or QuickPic, a much better app). There's no "gallery" folder.

So where did your pictures go? They probably got deleted. Now your question is "how do I recover a deleted picture?"

Well ... the first thing is to not to have to. Always back up anything that's important. (See Backing up an Android Phone.) If it's on your computer, and on a cloud account, and it gets deleted from your phone, oh, well. Another minute of your life wasted copying it back to the phone. An old computer saying has it that any file not backed up is a file you don't need. Of course it's the other way around - any file you don't need, you don't back up. But it's true. If it's worth having, it's worth backing up.

There are at least a few dozen free cloud accounts you can get by googling free cloud account. You can probably get a few TB of free space. Many of them have free apps, so you can do the backup right from the phone, out in the middle of I-40 (unless you're in Great Smoky Mountains National Park, also known as Great Smoky Mountains Signal Hole for all Carriers). Take a picture or video, it's great, back it up right then.

So from now on, make sure you back up at least the really important things as soon as possible. (Being a parent, grandparent, uncle, etc., almost makes me want to cry when someone lost the only pictures of their first child's first steps.)

But it's too late now, you didn't back that picture up and it's gone. What do you do? That depends on whether the file was on internal storage or the external SD card.

Internal Storage
Unless you're already set up to recover deleted files, you're probably going to lose at least part of one file. You can not recover a deleted file unless the phone is rooted. Don't look for a "way out", a "back door", you need access to a part of the file system that only the user "root" can access. (But see the last paragraph of this guide. Yes, you still have to be rooted, but it's one of those "whyt didn't I think of that" things. I've used dd many times over the years. It was so obvious once I saw it on the PhotoRec site.) Or, rather, the app you're going to use does. It's called DiskDigger undelete. The free version only recovers pictures. If you want to recover other types of files you need the paid version DiskDigger Pro. It's $3, not much as good apps go. (Install Google Opinion Rewards and you'll make that in a week or two - for spending 30 seconds a few times a week checking multiple choice answers.) (But, again, see that last paragraph.)

When a file gets "deleted", the file doesn't go anywhere - the space it's in gets marked as unused. Anything you save from that point on could get stored where that file was. So rooting the phone and installing DiskDigger could potentially overwrite one or more of the deleted files. (And, if you don't have an HTC phone, rooting the phone voids the warranty. [Evidently HTC doesn't see installing one file and one app as being a serious threat to the phone - and that's all rooting is.])

So, if you're ready to go, root your phone (look on XDA Forums for rooting instructions, files, etc., for your particular model phone if you don't know how to do it). Then go to the Play Store and install DiskDigger. Run it and it'll find lots of deleted files. Tell it to recover the one(s) you want. If you find a picture in which the bottom half, third, some part, is garbage, the space that part of the file was in got used to store another file. There's nothing you can do about that, except maybe edit the picture if the important part is still there.

(But see the last paragraph of this guide.)


External SD Card Storage
This one's easier, because all you have to do to the phone is take the SD card out. Put it into a card reader. This one will do the job, reads SD cards or microSD cards, is USB 3.0 and is only $6.

Now go to PhotoRec. Download the file. Extract the contents into a folder on your hard drive. (Name it PhotoRec if you want your hard drive to make sense to you.) Run photorec (the Windows version is named photorec_win.exe, the ones for other operating systems are similar.) BTW, this is a great improvement over the older version of PhotoRec (which I was running until I downloaded this one in order to write this guide. You used to have to burn PhotoRec to a disk, then start your computer with that disk. Now it's just a program.)

Be careful with 2 things:
1) The drives it's recovering from use the Linux naming convention, so the first drive (drive C in Windows) will normally be /dev/sda, the second one /dev/sdb, etc. Your card reader will be identified on the right end of the line as a media card reader or something to that effect - it won't be a hard drive type name like any others in the list. That's the one you want.

2) You must not recover to the media card reader. If you do, PhotoRec will find a file and write it to unused space on the card - just what you don't want. Recover to your C drive, your D drive, any drive other than the media reader. (Make a temporary folder to put the recovered files in.)

BTW, PhotoRec will recover a load of different file types, not just pictures. Not just file types you've heard of. So don't be surprised if it recovers 32GB of files from a 32GB SD card that's had everything deleted. (There's a list of file types it recovers in the menu when you're running the program You can tell it to not recover certain file types. By default, it recovers anything it knows.)

There's an excellent step by step explanation, with screen shots, of how to use PhotoRec at PhotoRec Step By Step - CGSecurity

CG Security has written a program that's worth a lot. It's free (and open source - if you're a programmer, you can grab the source, help add to it, etc.) Get it. If you can spare it, make a donation. They deserve it. (No, I'm not associated with them in any way. I've just been glad, many times, that I found this program.)

If you have an iPhone, you can even recover the deleted files from the iPhone with it. The main part of the process, dd, is available on a rooted Android phone too (I think it's in Busybox), so following the Recover Data from an iPhone procedure should work on an image file produced by dd on an Android phone as well. If it does, you can use that instead of DiskDigger. Of course the phone has to be rooted and Busybox has to be installed. And dd takes a long time to make an image file, so start it running before you have something to do that's going to take a while, or watching grass grow in the winter will be more lively and exciting.


can I use it to recover my deleted messages from my Samsung s6?
 

Rukbat

Retired Moderator
Feb 12, 2012
44,529
26
0
Visit site
You can recover deleted files (if they haven't been overwritten by something else since they were deleted), but if the data is stored in a database and you delete it, you have to use a SQLite editor, learn SQL and know a little bit about how SQL databases work. (And you still have to find the correct SQL data file.)
 

Thacy

Well-known member
Dec 18, 2015
277
0
0
Visit site
This is an old question, but still bothering people. This is an old (over two years) guide, while still working for most cases of data loss. Everybody should view this detailed tutorial before asking further questions. Yes, people definitely have far more questions since it is hard to fix every data losing problem with different scenarios on various devices.

BACK UP is the most important job. It is always easier to prevent than to treat.
 
Last edited by a moderator:

Rukbat

Retired Moderator
Feb 12, 2012
44,529
26
0
Visit site
File Recovery is $50, PhotoRec is free. I don't know what File Recovery will do if you've repartitioned the device (like an SD card), but since PhotoRec works on the data, not on directory entries, it won't matter. If it looks like any filetype it knows, it will start recovering it - even if the partition the file was in no longer exists. (Although the companion program, TestDisk, will recover the old partitions.) And PhotoRec "knows" a lot more file types than File Recovery appears to.
 

isaiah vinah1

New member
Jun 11, 2018
1
0
0
Visit site
How I get back my lost data of photos in the phone memory can please help meh to get back

I formated my phone and i lost all the data and photos how will get back my photos
 

Rukbat

Retired Moderator
Feb 12, 2012
44,529
26
0
Visit site
After formatting the entire phone, all partitions? You can't get anything back, you have to hope that you can at least flash some sort of ROM (even raw Linux) to start getting a phone back. Otherwise, all you have is a very expensive paperweight.

If you mean something other than "formatted my phone", tell us exactly what you did.

Recovering from formatting a hard drive, SSD or SD card is possible (if difficult) if all you did was a quick format. If you did a full format on a hard drive, it's also possible, if you have access to an electron microscope and someone with a lot of knowledge. But formatting the eMMC storage of the phone isn't possible if you formatted all the partitions.
 

delgriffith

Member
Jul 8, 2012
9
0
0
Visit site
My Galaxy S6 just randomly factory reset and wiped everything. It's running Android 7. Is this thread still valid? Didn't file based encryption start causing data recovery problems sometime around that release?