Recover files from internal memory - Android Q&A, Help & Troubleshooting

So basically, twrp recovery was not mounting my internal memory(phone was perfectly working) and I made the crucial mistake of not backing up my stuff before following a guide to fix it which consisted going in twrp recovery and repairing/changing system files. That resulted in everything being gone. Now, i used my phone as little as possible and have tried using phone recovery programs like dr.fone without any success. I've tried by following this answer here: https://stackoverflow.com/a/41397418 and I got a mmcblk0p66.raw file which is userdata after i used the commands and is around 55gb and the whole mmcblk0.raw file itself which is around 61gb. All this by forwarding from a cygwin64 terminal to another cygwin64 terminal through adb.
Code:
adb shell
ls -al /dev/block/platform/*phoneSpecificFolder*/by-name
I've tried mounting it with osfmount and then using recovery programs and using linuxreader to mount it and no success. I'm baffled how this 55+ GB files contain either empty folders or no files found and such. Am i doing something wrong or is it just me that actually STUPIDLY deleted everything? Also, I would do
Code:
adb shell
su
dd if=/dev/block/mmcblk0p65 of=/sdcard/userdata.img
but I would effectively overwrite any remains of files left due to it being 55gb in space. Much thanks. Every answer is appreciated.
Note: I mainly care about recovering my photos,videos
Xiaomi Mi Max 2 64BG

Related

Can someone get....

I'm in need of the stock kernal image and the clockwork recovery.zip file thingy.
NOT the zip verson of the kernal installer.
My situation, I was stupid and installed the voodoo thing, then for someone reason I tried to flash Froyo over Bionix with the voodoo kernal thing. It didnt work so I decided to deleted everything in clockwork. Then I was like omg I cant use clock work or boot my device (stuck on vibrant screen but I can get to odin and the stock recovery).
Later I read that voodoo stopped odin on the cm forum so I couldnt use it. Thats what some dude named viralblack said and theyre a mod so I'm guessing its true.
So my last 4 ideas are:
1)Try and flash a new Kernal Image in adb and hope it gets odin to work
2)Push the cw recovery to the phone
3)Run to the library and hope my computer is the problem
4)Pretend vb is wrong and keep trying the download screen thing
Sorry if this is in the wrong section but I guessed it could go here because I need some files....
flash Eugene's froyo that does not brick via Odin. he has instructions in his thread.
...and it's kernel NOT kernal people
Sent from my SGH-T959 using XDA App
kernel, sorry I guess?
Anyhow what if my pc doesnt notice the phone when its in download mode
RPGbig said:
kernel, sorry I guess?
Anyhow what if my pc doesnt notice the phone when its in download mode
Click to expand...
Click to collapse
Download the Samsung drivers, download ODIN, and then just follow the directions in the ODIN thread
Wow
You guys have nothing better to do than flame a newb?
If you spent half the time helping instead of flaming there MIGHT just be some people with a bit more knowledge than they had yesterday.
If you cant say something constructive/helpful --Why bother!
fcbarca17 said:
Download the Samsung drivers, download ODIN, and then just follow the directions in the ODIN thread
Click to expand...
Click to collapse
Push doesnt seem to work. Permission denied or something rather.
As I said in my first odin wont work, yes I did those things like 10 or so times.
You cant expect a newborn to know how to wipe themselves.
RPGbig said:
Push doesnt seem to work. Permission denied or something rather.
As I said in my first odin wont work, yes I did those things like 10 or so times.
You cant expect a newborn to know how to wipe themselves.
Click to expand...
Click to collapse
What do you mean "push doesn't work". Are you trying to push a file via adb? If you are getting permission denied errors, that is because you either do not have root access/permissions to write to the location you are trying to push to, or because the location you are trying to push to is mounted as read-only.
If you indeed have the necessary permissions (i.e., root), then `adb remount` will re-mount the device's partitions as read-write. If adb does not allow you remount the partitions in this manner, it is because you do not have the permissions to perform the duty.
If anyone is going to give any further help, though, you need to give us a bit more information. Can you access the device via adb? Can you boot into either download or recovery? (If you have adb access, you can usually boot into either of those with `adb shell reboot download` or `adb shell reboot recovery`.) Have you attempted to flash anything via Odin? What is the exact wording of the error messages you are receiving?
If you don't provide information, you won't receive any help. Vague responses such as "Permission denied or something rather" are useless because something rather can be any number of things. Also, attempting things without reading all of the information available beforehand is another way to ensure that people will be hesitant to give you help; this forum already has threads about where to locate the stock kernel image.
Also, instead of positing what-ifs such as "Anyhow what if my pc doesnt notice the phone when its in download mode", why don't you try putting your device into download mode and attaching it to a Windows computer with the proper drivers installed and Odin running, and then ask what the next step might be after you have attempted to do something?
People get angry about members flaming newbies for posting mistakes and asking for help, but if newbies looked for answers and read all of the information available before doing something they didn't understand (or only partially understood), then this wouldn't be a problem in the first place.
rpcameron said:
What do you mean "push doesn't work". Are you trying to push a file via adb? If you are getting permission denied errors, that is because you either do not have root access/permissions to write to the location you are trying to push to, or because the location you are trying to push to is mounted as read-only.
If you indeed have the necessary permissions (i.e., root), then `adb remount` will re-mount the device's partitions as read-write. If adb does not allow you remount the partitions in this manner, it is because you do not have the permissions to perform the duty.
Click to expand...
Click to collapse
Goalush Clockwork Recovery so I can flash Bionix.
What Happens:
1. Go into recovery
2. Connect to the phone with adb
3. I type 'adb push c:\update.zip /sdcard'
4. It says 'failed to copy `c:\update.zip` to `/sdcard/update.zip` : Permission denied
I type 'adb remount' its says ' remount failed: No such file or directory
rpcameron said:
If anyone is going to give any further help, though, you need to give us a bit more information. Can you access the device via adb? Can you boot into either download or recovery? (If you have adb access, you can usually boot into either of those with `adb shell reboot download` or `adb shell reboot recovery`.) Have you attempted to flash anything via Odin? What is the exact wording of the error messages you are receiving?
Click to expand...
Click to collapse
Yes, I can get into both.
I've download Froyo that doesnt brick. Unziped and got had the drivers from sansumg set up.
I usually type 'adb reboot download' to get into download mode for odin. Then when the phone shows the android guy with the shovel. Then my computer says that an unrecognized usb device has been connect.
This time I type 'adb shell reboot recovery' and its said
'-exce `/system/bin/sh` failed: No such file or directory (2) -'
rpcameron said:
If you don't provide information, you won't receive any help. Vague responses such as "Permission denied or something rather" are useless because something rather can be any number of things. Also, attempting things without reading all of the information available beforehand is another way to ensure that people will be hesitant to give you help; this forum already has threads about where to locate the stock kernel image.
Also, instead of positing what-ifs such as "Anyhow what if my pc doesnt notice the phone when its in download mode", why don't you try putting your device into download mode and attaching it to a Windows computer with the proper drivers installed and Odin running, and then ask what the next step might be after you have attempted to do something?
People get angry about members flaming newbies for posting mistakes and asking for help, but if newbies looked for answers and read all of the information available before doing something they didn't understand (or only partially understood), then this wouldn't be a problem in the first place.
Click to expand...
Click to collapse
RPGbig said:
Goalush Clockwork Recovery so I can flash Bionix.
What Happens:
1. Go into recovery
2. Connect to the phone with adb
3. I type 'adb push c:\update.zip /sdcard'
4. It says 'failed to copy `c:\update.zip` to `/sdcard/update.zip` : Permission denied
Click to expand...
Click to collapse
You have to be rooted.. But why would you even take the hard way to use clockwork? Just download it from the market..?
I have odin with all the files that will get u to stock of ur phone. Also the froyo files does not brick. So now i exactly dont know what u need. go cows
I messed up my phone and its stuck in a bootloop. I want to put that recovery on my phone so I can flash a new rom.
RPGbig said:
I messed up my phone and its stuck in a bootloop. I want to put that recovery on my phone so I can flash a new rom.
Click to expand...
Click to collapse
If your phone is stuck in a bootloop you need to flash your phone with odin
RPGbig said:
Goalush Clockwork Recovery so I can flash Bionix.
What Happens:
1. Go into recovery
2. Connect to the phone with adb
3. I type 'adb push c:\update.zip /sdcard'
4. It says 'failed to copy `c:\update.zip` to `/sdcard/update.zip` : Permission denied
I type 'adb remount' its says ' remount failed: No such file or directory
Click to expand...
Click to collapse
OK, if `adb remount` isn't working properly, then you have to manually instruct the system to remount the system partition as read-write. This is a little different from other Android devices, because Samsung insists on using their screwy RFS. On my device, the system partition resides at /dev/block/st19. If you can get an adb shell session, opened, you can verify it by running `mount`, and seeing which /dev node is assigned to /system. Then, manually remount the system partition with `mount -o remount,rw -t rfs /dev/block/st19 /system`; this must be done as root.
It does seem a bit odd that you are getting a permission denied error on /sdcard. Are you sure that /sdcard is mounted? You can verify the same way you check what /dev node holds you system partition. On my Vibrant, /sdcard is the mount point for /dev/block//vold/179:1 (yes, that is two slashes after block). So, the command to mount the internal SD card is `mount -o remount,rw -t vfat /dev/block//vold/179:1 /sdcard`.
Now those commands should ensure that you have both your system partition and SD card mounted as read-write. Now you can copy over the update.zip that contains ClockworkMod recovery to the root of your SD card (/sdcard) with `adb push drive:\path\to\recovery.zip /sdcard/update.zip`. I recommend specifying a destination filename for update.zip. Also, sometimes an adb push command requires the trailing / of a directory.
RPGbig said:
Yes, I can get into both.
I've download Froyo that doesnt brick. Unziped and got had the drivers from sansumg set up.
I usually type 'adb reboot download' to get into download mode for odin. Then when the phone shows the android guy with the shovel. Then my computer says that an unrecognized usb device has been connect.
This time I type 'adb shell reboot recovery' and its said
'-exce `/system/bin/sh` failed: No such file or directory (2) -'
Click to expand...
Click to collapse
This last statement looks like either your system partition is not mounted, or that it does not have a shell installed. From an adb shell session, check the /system/bin directory and see if there is indeed a shell binary there (either sh itself, or sh linked to another shell such as bash). If there is no /system, then it means that your system partition is not mounted, and you can follow the steps I previously mentioned to mount the system partition.
RPGbig said:
I messed up my phone and its stuck in a bootloop. I want to put that recovery on my phone so I can flash a new rom.
Click to expand...
Click to collapse
Can you boot into recovery using the VOL_DN and POWER method, or does the adb daemon ever come online during the bootloop? If so, then either boot into recovery from a powered-off state, or use the adb shell to boot it into recovery.
http://forum.xda-developers.com/showthread.php?t=810130
rpcameron said:
OK, if `adb remount` isn't working properly, then you have to manually instruct the system to remount the system partition as read-write. This is a little different from other Android devices, because Samsung insists on using their screwy RFS. On my device, the system partition resides at /dev/block/st19. If you can get an adb shell session, opened, you can verify it by running `mount`, and seeing which /dev node is assigned to /system. Then, manually remount the system partition with `mount -o remount,rw -t rfs /dev/block/st19 /system`; this must be done as root.
It does seem a bit odd that you are getting a permission denied error on /sdcard. Are you sure that /sdcard is mounted? You can verify the same way you check what /dev node holds you system partition. On my Vibrant, /sdcard is the mount point for /dev/block//vold/179:1 (yes, that is two slashes after block). So, the command to mount the internal SD card is `mount -o remount,rw -t vfat /dev/block//vold/179:1 /sdcard`.
Now those commands should ensure that you have both your system partition and SD card mounted as read-write. Now you can copy over the update.zip that contains ClockworkMod recovery to the root of your SD card (/sdcard) with `adb push drive:\path\to\recovery.zip /sdcard/update.zip`. I recommend specifying a destination filename for update.zip. Also, sometimes an adb push command requires the trailing / of a directory.
This last statement looks like either your system partition is not mounted, or that it does not have a shell installed. From an adb shell session, check the /system/bin directory and see if there is indeed a shell binary there (either sh itself, or sh linked to another shell such as bash). If there is no /system, then it means that your system partition is not mounted, and you can follow the steps I previously mentioned to mount the system partition.
Click to expand...
Click to collapse
I tried 'adb root' and then it said 'adbd cannot run as root in production builds'
By shell session do you mean 'adb shell'? No, I dont believe that works because I get 'adbd cannot run as root in production builds'
When you mean 'shell installed' you do I have it installed on the phone? If it isnt is there anyway I could do it now?
`adb push drive:\path\to\recovery.zip /sdcard/update.zip` didnt work and gave me 'c:\update.zip' to '/sdcard/update.zip': Permission denied
Can I flash /system via my pc onto my phone? or Use the external sdcard instead of the internal?
Dude, if your phone is stuck in a bootloop, you HAVE TO FLASH IT VIA ODIN. There's no other work-around.
RPGbig said:
I tried 'adb root' and then it said 'adbd cannot run as root in production builds'
By shell session do you mean 'adb shell'? No, I dont believe that works because I get 'adbd cannot run as root in production builds'
When you mean 'shell installed' you do I have it installed on the phone? If it isnt is there anyway I could do it now?
`adb push drive:\path\to\recovery.zip /sdcard/update.zip` didnt work and gave me 'c:\update.zip' to '/sdcard/update.zip': Permission denied
Can I flash /system via my pc onto my phone? or Use the external sdcard instead of the internal?
Click to expand...
Click to collapse
Why did you try `adb root`? I don't quite understand that.
A shell session would be `adb shell`, yes. On your computer's command line, invoke `adb shell`. You are now in a shell session. What does the prompt look like? Is it "#" or "$". If it is a hash, then you have root access via adb. If it is a dollar sign, then you do not have root access; try running `su` from within the shell session. If the prompt does not change to a hash, then you are stuck for the moment, because you do not have root access via adb, and therefore nearly all of the adb commands will not work.
By "shell installed" I was referring to a shell interpreter installed on your handset. bash is the most commonly installed Linux shell, and sh is usually just a pointer to bash. If your handset does not have either /system/bin/sh or /system/bin/bash (or anything similar), then you have an incomplete system, and it got messed up along the way with something you did.
But, since it seems that you cannot gain root access through adb, and therefore cannot (re)mount your partitions, you are basically limited in your options. All you can really do is put your phone in download mode, and use Odin to reflash a complete system (including a kernel image). I would also recommend that you use the repartition option in Odin to make sure that your partitions are reformatted and you are essentially left with a wiped and clean handest to start with.
(Lack of root access via adb has severely limited your options. You are basically left with Odin as your only avenue of recourse, unless you are willing to disassemble your device to get to the internal SD card.)
Have you opened yours? Is it an actual (micro) sdcard that can be taken out like the external one?
I typed 'adb root because typing 'adb' showed this
adb root - restarts the adbd daemon with root permissions
so I guess that was what you ment by root.
When I type 'adb shell' all it gave was - exec '/system/bin/sh' failed: No such file or directory (2) -
You need to stop trying to do it the hard way and just use Odin. If your phone is not being recognized then you need the correct drivers. Once installed, you should be back up and running within 5 minutes. Stop lollygagging and fix your phone already.

flash_image no effect

I don't normally need help like this, but this has left me baffled.
I have done this before without any problems but for some reason it doesn't want to work now.
I put flash_image into /system/bin/ and set its permissions to 777.
I have recovery.img on my SD-Card so its path is /sdcard/recovery.img
Over ADB (I have used a Terminal Emulator too) I enter adb shell, and then get super user permission 'su'. I then enter :
flash_image recovery /sdcard/recovery.img
NO errors occur, but it just seems to 'skip' to the next line so I can enter another command. Normally it gives a few rows of 'mtd: writing block 0x00000054' etc...
So I thought... ok... maby it has flashed it, so I boot into recovery to find the stock recovery (no... I'm not flashing the stock recovery I'm trying to flash CWM)
Any help?
Nobody has had this problem?
similar problem
I have a similar problem on a newly rooted htc incredible, downgraded to 2.2. I used /data/local/flash_image to back up my data into a file /sdcard/data_backup.bin (a 154MB file, so I know there is a lot there)
When I tried to recover that file for the first time, I get these lines:
Code:
#/data/local/flash_image datadata /sdcard/data_backup.bin
mtd: not writing bad block at 0x______
mtd: not writing bad block at 0x______
...
That doesn't bring back my apps or data, I still have only the factory default apps (I still have music and pictures, but not the apps). When I try to flash_image again, nothing happens.
So, being a noob, I have lots of questions:
1. are the bad blocks on my phone memory or the sd card?
2. what effect do the bad blocks have?
3. Is there a way to fix/ignore the bad blocks with a defrag or something?
4. Are the bad blocks really the issue?
5. Is there another, perhaps manual way to get the data out of my data_backup.bin file other than flash_image?
6. It looks like my datadata partition is having a problem--can I reassign the partition away from bad blocks?

irulu 10.1 root/remount problems solved

I own an irulu K1001L1 10.1 (build number A20_K1001_K1001L1.20130713), a cheap one.
Many people complain about "partial rooting" and being unable to remount system in rw mode. Clueless as I was, I had tried several times with Uberizer, z4root and SRSroot, to no avail (the problem is not in the root, in my tablet su came by default in xbin directory).
D_rex (http://forum.xda-developers.com/show...2606510&page=2) found an effective solution which also helped in my situation: I think my tablet came with "su" application by default (notice overclocking worked) but due to /dev/block/nandd ext4 partition (I think /system starts at some offset) containing some errors (seen in dmesg) and due to this partition having the "s_errors" flag (behavior when errors detected) set to "mount read-only (02)", the partition is ALWAYS mounted read only, and remount as root doesn't change anything. More info on this ext4 option can be found here: https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout.
For me, the solution that worked was changing that flag s_errors to continue (01). I wasn't able to run e2fsck as the partition is already mounted; and I wasn't able to do a fsck in recovery mode since the recovery mode of this tablet lacks seems to lack both shell and e2fsck.
Tune2fs (old version precompiled here can change that flag in the partition. Using adb shell I pushed it to de device, set attribute as executable and run it, successfuly changing that "behavior when errors detected" in both partitions.
It has been suggested filesystem errors are linked to stability and realiability problems. Unfortunately this tablet lacks a version of CWM o TWRP as a recovery custom rom. I also adjusted the "max-mount-counts" value via tune2fs -c hoping it forces Android to run e2fsck, but it seems dmesg keeps displaying errors. I can only hope this problem is given more attention by developers.
After this I used the usual tools to root the device, noticing I had spent many hours in this cheap tablet. I should also mention by default now my tablet mounts in read-only mode (which is of course safer) but lets me change to rw whenever I want.
I have not been able to fix the ext4 errors. As others have explained, ls -al /dev/block can be used to better understand the images structure. System partition (nandd) contains the file e2fsck , but that file seems to be unavailable before mounting. Editing init.rc and associated files didn't force a diskcheck; I have not tried imaging the recovery partition (/dev/block/nandg) with dd and manually adding the required tools.I should also mention by default now my tablet mounts in read-only mode (which is of course safer) but lets me change to rw whenever I want.
On a side note, the adb driver setup tool found here didnt work for me (it seems &USER_PROFILE% in the .bat file should be replaced by "%USER_PROFILE%" and Desktop should be replaced according to the language of your operating system. Nevertheless the tool didn't work for me and I had to install another driver found in Uberizer distribution as the official "android_winusb.inf" didn't work in my Windows XP computer.
Thanks to the creators of tune2fs, to D_rex and other people/programs mentioned here. This is my experience with this problem; I'm not responsible if anyone tries this and bricks his device. All brands are property of their owners.
Good luck and Good bye

Help performing data recovery after self-inflicted wipe

Greetings all,
This is a fully should-have-had-more-coffee-before-attempting scenario, but hoping there's still a way I can get data back.
*Backstory*
Have a Pixel 2 XL. Decided to try out Android P beta through the opt-in. Used it for a while, decided there were too many bugs that affected my daily usage, opted-out of Beta. What I didn't realize was that after downgrading back to Android O, the phone would perform a factory wipe on the /userdata folder. There's a specific subfolder on that partition that I'm hoping I can do a data recovery on.
*The Story so Far*
After spending a day googling and coming up to multiple XDA posts & few blog entries about data recovery on android, I have done the following.
- gain root devices using Magisk to flash patched boot image
- found that the /userdata is located at /dev/block/sda13 symlinked from /dev/block/platform/soc/.../by-name/userdata
- see that the most probable way of getting files back is to pull the entire partition over as a raw file, then use TestDisk (or qPhotoRec) to try and perform a data recover on the file as you would a normal drive, since there are few, if any, tools that will run recovery directly on the device.
*The Problem*
The research led me to attempting to run the following command as a binary safe transfer of the partition.
Code:
adb exec-out "su -c 'cat /dev/block/sda13'" > userdata.raw
However when I run that, while it does start creating the userdata.raw file on my local machine, it gets to ~4gb, then the file just stops getting any larger and I've let it sit for over an hour. The command in adb never times out or returns to a prompt, it's like it just stops transferring the output from adb into the file. I know the size of the userdata partition is ~65gb from going into shell and looking at it.
I've also tried various chmod hacks of temp setting 777 on the file just to see if I can do an adb pull on it, however nothing I'ved tried so far yields anything other than a Permission Denied when I try that.
Does anyone have any ideas on how I can get a complete transfer of the userdata partition over to my local drive so I can run data recovery on it?

[HELP!] Recovering NANDroid backup files from raw clone of formatted internal storage

I had been flashing a rom onto my phone (RR 8.0) and customarily had taken a TWRP nandroid backup of the existing rom (RR 7.1.2). Then when I went to wipe data, cache, system, I had accidentally checked the internal storage too and wiped it as a result. At this point all I could do was flash the rom, then magisk root and busybox, then I cloned internal storage (which I identified using cat /proc/partitions to be block sda18) using ADB and Cygwin (with the netcat package) thus:
Code:
TERM-1
------
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/sda18
TERM-2
------
adb forward tcp:5555 tcp:5555
nc 127.0.0.1 5555 | pv -i 0.5 > sda18.dd
Couple hours later I end up with ~23.5 GB of raw partition dump (all 24,649,728 blocks of sda18 copied, I checked). Now most file recovery software (Testdisk, PhotoRec, [email protected] products) I've tried seem to check for file signatures/extensions, naturally TWRP's backups aren't among them.
TL;DR: All I need at this point is one file in particular: data.ext4.win?? – the backup of the data partition, hope I got that extension right – by a data recovery software that can hunt those very few backup files from a cloned internal storage image.
(No, partition recovery is no good.)
Clearly these files are still out there among the sectors because all that I'd done to internal storage was a format. Having come so far I find it hard to believe there isn't software that can find TWRP backup files due to its variable filetype extension. I would assume the file signature is that of TAR files, but I'm not sure.
Recovering these backups is important to me because trying to recover files from the data partition, for example, ends up returning nondescript, unlabeled data by the thousands, no way to know which file is which (looking at you, Photorec). Restoring a backup would return the data partition exactly the way it was before it was wiped out. The rest of what used to be the contents of my internal storage are not important to me. I have over 2,000 contacts that were not backed up to any online or offline service, which most definitely resides in that backup file. Please help me with some legitimate solution or suggestion rather than to say it won't be possible – no reason to believe so when I have the cloned image of the internal storage – at the very least a data recovery software that can help me get those deleted backups out ASAP (my business relies critically on those contacts and chat app histories). Time is of the essence here, I humbly request the community's help urgently.
PS I realize this question has more to do with forensic data recovery but I'll still give it a shot in here. Hope this post isn't too vague in stating what I want done. I'm sure this would massively help others in the future too, given how common such an occurrence is.
The problem is not only did you format it but when the system was setting up it also altered it. So the data maybe gone and anything that could find it is beyond the skills found on this forum these days.
zelendel said:
The problem is not only did you format it but when the system was setting up it also altered it. So the data maybe gone and anything that could find it is beyond the skills found on this forum these days.
Click to expand...
Click to collapse
I don't deny that. But assuming data written is sequential only 30-50 MB would've been written since. And the backups were taken when the internal storage already had around 8-9 GB of other data. Which I believe should mean that there's still a chance that the backup files weren't overwritten.
Although now that you mention it I'm beginning to have my doubts, considering wear leveling patterns for NAND flash memory...
PS Photorec identifies twrp backups as tar files with wrong extension but that doesn't seem to recover anything anyway. I guess you're right :'(

Categories

Resources