[GUIDE] Internal Memory Data Recovery - Yes We Can! - Samsung Galaxy Nexus

This method does not seem to work on newer phones that apply TRIM or some other type of partition clearing implementation. If anyone has recovered their data on a device newer than Android 4.3 please pm me and let me know.
The Preamble
Did you delete all your SDCard data?
Are you pissed because no one told you before you unlocked your bootloader what would happen?
Did you lose valuable pictures of cats doing wondrously funny things? :laugh:
Well now there's a convenient new way for you to get that data back Buckaroo!
The Problem
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! :crying:
The Process
My phone is the Samsung Galaxy Nexus (toro) though I imagine 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,
?
profit! :good:
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... :fingers-crossed:
The Work
*****Based on the number of people having trouble with this step it is now my recommendation that you choose to recover your entire memory block instead of just the data partition. In my phone's case that is mmcblk0. Please discover if yours is different.***** Identify which block/partition you want to recover. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p12
Turn on your phone
Connect the phone in ADB mode
Unlock the screen.
Open a Cygwin terminal and enter (This assumes your BusyBox installation is at [/system/bin/busybox]. It may be at [/system/xbin/busybox]):
Code:
adb forward tcp:5555 tcp:5555
adb shell
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
Open another Cygwin terminal and enter:
Code:
adb forward tcp:5555 tcp:5555
cd /nexus
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw
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...
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:
Code:
VhdTool.exe /convert mmcblk0p12.raw
Now we need to mount the VHD in Windows. Select the Start button-->right-click Computer-->select Manage.
Select Storage-->Disk Management.
In the menu select Action-->Attach VHD.
For Location enter [c:\cygwin\nexus\mmcblk0p12.raw] and select the OK button.
Right-click on the name (e.g. "Disk 1") to the left of the Unallocated space and select Initialize Disk.
Select the GPT (GUID Partition Table) radio button and select the OK button.
Right-click on the Unallocated space and select New Simple Volume...
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.
A box will pop up asking you to format the drive. You DO NOT want to format the drive at this time.
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.
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!)
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.
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.
?
Profit! :victory:
The Appendix
The following links helped me to create this modern marvel - mad props to scandiun! :
[GUIDE] How to make a nandroid backup directly to your computer without using sdcard
[Info] List of Samsung Galaxy Nexus GT-I9250 devices and partitions
How to Create and Attach a Virtual Hard Disk in Windows 7
Good luck!

I forgot to mention, but run commands inside android as superuser or may fail (just after adb shell):
Code:
adb forward tcp:5555 tcp:5555
adb shell
[B]su[/B]
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
And greetings for the guide, I didn't know of VHD Tool, congratulations!.

Great Work
scandiun said:
I forgot to mention, but run commands inside android as superuser or may fail (just after adb shell):
Code:
adb forward tcp:5555 tcp:5555
adb shell
[B]su[/B]
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
And greetings for the guide, I didn't know of VHD Tool, congratulations!.
Click to expand...
Click to collapse
Good and informative tutorial indeed. Thanks though.

Good point...
scandiun said:
I forgot to mention, but run commands inside android as superuser or may fail (just after adb shell):
Code:
adb forward tcp:5555 tcp:5555
adb shell
[B]su[/B]
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
And greetings for the guide, I didn't know of VHD Tool, congratulations!.
Click to expand...
Click to collapse
Thank you again scandiun
You may be right about the superuser command: su
For my part I did not have to use it but I'm sure it wouldn't hurt to run as su. Some systems may actually need it though.

Here's hoping...
oliverpowell said:
Good and informative tutorial indeed. Thanks though.
Click to expand...
Click to collapse
Thank you oliverpowell
I just hope the people who need this actually find it before they give up and start overwriting their lost data. Even having to get root access may cause a certain amount of data loss for some. Thankfully I was already rooted and already had busybox....

YOU..
YES YOU....!!!!!
WHERE HAVE YOU BEEN ALL MY LIFE?
s*it mate, i wish this thread comes earlier...
i lost my precious files on sdcard about 3 months ago when unlocking bootloader.
um..
anyway do you have any idea how to make files from computer back to internal memory,
but without changing the date modified timestamp?
i'm using adb push for that, but that's painfuly slow..
while mtp transfer messed up the date modified.
thanks, bookmarked.
just in case i do something stupid next time..

Not many options...
marhensa said:
um..
anyway do you have any idea how to make files from computer back to internal memory,
but without changing the date modified timestamp?
i'm using adb push for that, but that's painfuly slow..
while mtp transfer messed up the date modified.
Click to expand...
Click to collapse
I'm afraid painfully slow is probably the only option, just like my step that takes three hours. Start it and go build a birdhouse or window box for flowers....it's going to take a while.
I'm sorry you lost files. It's very sad to hear some of the stories of people losing pictures of their children's birth, or the last pictures of their husband going to Afghanistan... and not returning.
I'm hoping that this approach or one like it can be made popular. It needs to get out there.

I've also linked this thread and scandiun's thread in the second post of this sticky thread.

Nice!
efrant said:
I've also linked this thread and scandiun's thread in the second post of this sticky thread.
Click to expand...
Click to collapse
It looks good! Thank you.

Thanks for this tutorial. :good: It worked as indicated. I just wish I knew earlier as I had been trying for the past few days to use recovery tools and trying to make the internal drive USB Mass Storage capable when all this time there was this tutorial. Unfortunately, it only returned a dozen photos. Thanks again for this tutorial... this should be spread across xda forums for any others running into these issues.

xda_toronto said:
Thanks again for this tutorial... this should be spread across xda forums for any others running into these issues.
Click to expand...
Click to collapse
Agreed - lol
Firstly, I only recently created this guide. I'm sorry you lost files
Secondly, I attempted to link to older threads that mention the same issue so that they would be more likely to show up in a future Google search but I was scolded for waking up old threads, which makes sense. I just thought this was a rather seriously important issue that deserves a lot of eyes. Loss of personal photos is a little more significant than troubleshooting a bad ROM flash, IMO. But the Mod correctly canceled those other posts. It is a little douchey to try to increase a post count by linking all over to a single (my first, really) post. However, I couldn't give less of a pbbbttt about post counts. If you don't mind me asking, how did you find this thread?
Lastly, if you add it to your sig then this will show up on all of your posts...just sayin'...
I'm glad it at least helped you get 12 pics back...

Proplem
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ?? see the picture attached
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}

I have a question. Let's say we don't want somebody to ever use this guide to recover our stuff after we sell them a phone. What's the most secure and thorough way to destroy all data on the Gnex, making it impossible to recover, short of destroying the phone?

Med1a said:
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ?? see the picture attached
Click to expand...
Click to collapse
i have the same problem

A couple things from you screenshots...
Med1a said:
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ??
Click to expand...
Click to collapse
Did you try without using su command? Also where is busybox installed? /system/bin or /system/xbin?

CADude said:
I have a question. Let's say we don't want somebody to ever use this guide to recover our stuff after we sell them a phone. What's the most secure and thorough way to destroy all data on the Gnex, making it impossible to recover, short of destroying the phone?
Click to expand...
Click to collapse
If you use the erase command in fastboot, it should work (i.e., "fastboot erase userdata"), otherwise, flashing the stock userdata image will do the trick (i.e., "fastboot flash userdata userdata.img") <-- this writes a blank image in the userdata partition.

...well, that's a good question!
CADude said:
I have a question. Let's say we don't want somebody to ever use this guide to recover our stuff after we sell them a phone. What's the most secure and thorough way to destroy all data on the Gnex, making it impossible to recover, short of destroying the phone?
Click to expand...
Click to collapse
I would imagine you could do this guide, use a Guttman algorithm wipe utility on the attached VHD and then figure out a way to push the entire VHD back to the phone. Unfortunately, that may not actually overlay the physical phone memory in the same way. Perhaps you could wipe the VHD again and push it again, and then again...?
I want to say that someone asked the question on scandiun's post too. Go see if they figured out how to push back to the phone.
Good luck

Wartickler said:
Did you try without using su command? Also where is busybox installed? /system/bin or /system/xbin?
Click to expand...
Click to collapse
busy box installed properly in the right directory
su command used

Med1a said:
Sir .. I'm facing problem .. it won't receive any data from 5555 port .. I tried to make it copy the RAW file but it stopped without getting any data .. is that normal ?? see the picture attached
Click to expand...
Click to collapse
hetunandu said:
busy box installed properly in the right directory
su command used
Click to expand...
Click to collapse
When running su check on phone that permissions are granted. Furthermore using absolute paths is for when you are running it from clockworkmod recovery. If the phone is powered on you can use
Code:
adb forward tcp:5555 tcp:5555
adb shell
su
nc -l -p 5555 -e dd if=/dev/block/mmcblk0p12
Open another Cygwin terminal and enter:
Code:
adb forward tcp:5555 tcp:5555
cd /nexus
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw
If you are still having problems you can try the command within the phone only and see if dd works:
Code:
adb shell
su
dd if=/dev/block/mmcblk0p10 of=/dev/null
Also, make sure you run all the commands in the two terminals each time and in the proper order, if you are not sure cancel with Control+C and close them and restart again.
For those who want to try backing up the partition via wifi, you can send it via ftp. Read this post:
http://forum.xda-developers.com/showthread.php?p=27793062#post27793062

Don't use su...?
hetunandu said:
busy box installed properly in the right directory
su command used
Click to expand...
Click to collapse
Please try no su exactly as in the first post.
Did you follow the steps exactly? I can only say they worked for me ):
What phone do you have?

Related

[Q] Adfree on Droid Incredible

Philosophical issues aside, how does one get this working? A crucial barcode program i use has amazingly annoying religious ads.
Here is what I have tried:
Rooted with Unrevoked / Nandroid Backup / Titanium Backup / wifiTether /Led flashlight. Stock otherwise.
Install adfree, ran it, phone rebooted.
Boot into clockwork recovery and launch adb shell.
Execute the following:
Code:
2. Install and run
3. allow it to download and install new hosts file, it will copy it to your sdcard and try to replace /system/etc/hosts but fail (it should reboot the phone shortly)
4. Power off the phone and hold Volume Down and power.
5. Use volume down to select recovery
6. In clockwork recovery volume down to "partitions menu" and hit the track pad to select
7. Select "mount /system" and "mount /sdcard" "mount /data"
8. Plug in your usb cord and open a command line on your pc
9. enter adb shell and type the following commands
cp /sdcard/hosts /data/data/hosts
rm /system/etc/hosts
ln -s /data/data/hosts /system/etc/hosts
On reboot, no change, and adfree fails trying to update. Help?
heliotropeUCSD said:
Code:
cp /sdcard/hosts /data/data/hosts
rm /system/etc/hosts
ln -s /data/data/hosts /system/etc/hosts
Click to expand...
Click to collapse
I found a post earlier that changes the paths. It has worked for me on every Rom I have tried.
Code:
cp /sdcard/hosts /data/hosts
rm /system/etc/hosts
ln -s /data/hosts /system/etc/hosts
Sent from my ADR6300
Hmmm, still didn't work. Can you go into a little bit more detail? I'm stock everything, just rooted.
The philosophical struggle goes deeper than what you think! Another method (frowned upon by most uninformed members of this forum but endorsed by some of the experts) is to do a tempoary nand unlock using the unrevoked tool.
Run the tool like normal, then unplug after the "running pre-boot sequence" and during "waiting for reboot". I've done it plenty of times perfectly, it allows you to run adfree normally without any special tricks (just default settings). I have no idea what happens if you unplugged at the wrong time (you have a like 20-second window ffs) but I hear it's bad.
Do it at your own risk
I'd just like to point out that I think the above suggestion is actually INTENDED to brick phones. I wouldn't recommend anyone try it. Does anyone have any real suggestions? I have a serious problem with religious ads on my f***ing telephone.
heliotropeUCSD said:
I'd just like to point out that I think the above suggestion is actually INTENDED to brick phones. I wouldn't recommend anyone try it. Does anyone have any real suggestions? I have a serious problem with religious ads on my f***ing telephone.
Click to expand...
Click to collapse
Listen bro, this method works just fine.
Run unrevoked 3.1 when you are in the OS, then it will reboot your phone to hboot and then it unlocks your nand, it will reboot and you will see the white incredible screen, at this time you can unplug your USB cable, I just suggest doing it before it gets back to the OS so you don't pull it when it is flashing your recovery, but if you do it at the white incredible screen or during the bootanimation. Then when you get back to the OS, run adfree and update your hosts, success, profit?
I can confirm that it will work 100% without bricking your phone. Anyone who said it has is full of ****. Don't listen to those **** smoking noobs out there that are hanging on to unrevoked teams ballsacks. This will not brick your phone if you do as I said above. If this bricked your phone then it would not be safe to use the unrevoked program period. So don't listen to the noobs out there, this method works 100% without issue. I posted this method awhile back and everyone got upset like I did something wrong, but people did verify it did work if you want to find the post I made look for it.
Hmm, well. I have no idea, it sounds like you may be right, but it isn't the type of solution that i am looking for.
I'd like to find a way to use the symbolic link method to store the hosts file somewhere where adfree can write to it. Does anyone else have an idea?
heliotropeUCSD said:
Hmm, well. I have no idea, it sounds like you may be right, but it isn't the type of solution that i am looking for.
I'd like to find a way to use the symbolic link method to store the hosts file somewhere where adfree can write to it. Does anyone else have an idea?
Click to expand...
Click to collapse
sym link doesnt work for me, um, I would just do what I stated above if all else you tried has failed.
I used the above method in the #1st Post on an 2.2 ROM with no issue! I can update Adfree at any point after completing those directions...
here is where I found those directions... http://www.jonamerica.com/technology/howto-root-the-htc-droid-incredible/
Hmm. I am really, genuinely scared of the method posted by TNS201. I believe him that it may work, but I simply don't understand the mechanism. Is he suggesting that this successfully unlocks the NAND memory? Or does it allow it to be unlocked for one boot cycle, in which case I can't update adfree?
heliotropeUCSD said:
Hmm. I am really, genuinely scared of the method posted by TNS201. I believe him that it may work, but I simply don't understand the mechanism. Is he suggesting that this successfully unlocks the NAND memory? Or does it allow it to be unlocked for one boot cycle, in which case I can't update adfree?
Click to expand...
Click to collapse
Why do say that it "may" work. I can confirm it works 100%, I wouldn't tell you something that doesn't. It unlocks the NAND for one boot. So you can write to system and such during this time. The duration of this lasts until you power off or reboot your phone. This stays active until next reboot. You can update adfree and reboot if you want.
TNS201 said:
Listen bro, this method works just fine.
Run unrevoked 3.1 when you are in the OS, then it will reboot your phone to hboot and then it unlocks your nand, it will reboot and you will see the white incredible screen, at this time you can unplug your USB cable, I just suggest doing it before it gets back to the OS so you don't pull it when it is flashing your recovery, but if you do it at the white incredible screen or during the bootanimation. Then when you get back to the OS, run adfree and update your hosts, success, profit?
I can confirm that it will work 100% without bricking your phone. Anyone who said it has is full of ****. Don't listen to those **** smoking noobs out there that are hanging on to unrevoked teams ballsacks. This will not brick your phone if you do as I said above. If this bricked your phone then it would not be safe to use the unrevoked program period. So don't listen to the noobs out there, this method works 100% without issue. I posted this method awhile back and everyone got upset like I did something wrong, but people did verify it did work if you want to find the post I made look for it.
Click to expand...
Click to collapse
...eloquently said, sir...
Anyway OP, if you don't wanna do it, that's fine. And I think it's wonderful that you don't care whether anyone questions your sexual orientation
(FUTURAMA REFERENCE, DON'T FLAME ME.)
Seriously, why are the uninformed so cocksure?
Yeah, but somebody must have gotten the symlink method to work. I'm not willing to risk bricking my phone in any way to do this- like I said, there are philosophical issues here. I'd rather just see the ads.
So, again- has anyone with an Incredible, rooted, stock rom, used the symlink method to install adfree?
heliotropeUCSD said:
Hmm. I am really, genuinely scared of the method posted by TNS201. I believe him that it may work, but I simply don't understand the mechanism. Is he suggesting that this successfully unlocks the NAND memory? Or does it allow it to be unlocked for one boot cycle, in which case I can't update adfree?
Click to expand...
Click to collapse
As stated in my earlier post, I have it working on my Incredible and it has worked for me on 4 different ROMS.
This may not work for you, but it does work for me. I found these tips awhile ago and don't remember where I found them.
NOTE: Notice the paths in the commands below - They differ from the original post.
Boot into clockwork recovery and launch adb shell.
Execute the following:
Code:
2. Install and run
3. allow it to download and install new hosts file, it will copy it to your sdcard and try to replace /system/etc/hosts but fail (it should reboot the phone shortly)
4. Power off the phone and hold Volume Down and power.
5. Use volume down to select recovery
6. In clockwork recovery volume down to "partitions menu" and hit the track pad to select
7. Select "mount /system" and "mount /sdcard" "mount /data"
8. Plug in your usb cord and open a command line on your pc
9. enter adb shell and type the following commands
cp /sdcard/hosts /data/hosts
rm /system/etc/hosts
ln -s /data/hosts /system/etc/hosts
Note the last command, that it a lowercase L not an I
a couple of others have made that mistake (for best results copy each command to your clipboard and paste it into your command prompt).
Reboot the phone and it should work now.
Use BTC IP and do not check symlink from /data/data/hosts
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
gadget!
heliotropeUCSD said:
Yeah, but somebody must have gotten the symlink method to work. I'm not willing to risk bricking my phone in any way to do this- like I said, there are philosophical issues here. I'd rather just see the ads.
So, again- has anyone with an Incredible, rooted, stock rom, used the symlink method to install adfree?
Click to expand...
Click to collapse
Are you getting any errors in the shell when you type the commands?
should look like this when you enter a command
Code:
# ln -s /data/data/hosts /system/etc/hosts <--hit enter
ln -s /data/data/hosts /system/etc/hosts
#
First, can you go into recovery, and let me know if this command returns hosts
Code:
ls /data/data | grep hosts
This lists the directory and "filters" out everything but the text after grep.
output should look like:
Code:
# ls /data/data | grep hosts
ls /data/data | grep hosts
hosts
#
I need to know, because I think that adfree might not have made a hosts file on your sdcard when you ran before starting, thus there was no hosts file to "cp" form /sdcard to /data/data/.
If that is the case, and since you have rm'ed your hosts file from /system/etc/, you will have to recreate the file with the touch command.
My $.02
***********************************
It is NOT necessary to run or even install adfree before getting your hosts files setup in the system.
Here is the method I use:
1. copy the existing hosts file to /data/data
Code:
cp /system/etc/hosts /data/data/hosts
2. rename hosts to hosts.bak
Code:
mv /system/etc/hosts /system/etc/hosts.bak
3. symlink the hosts files
Code:
ln -s /data/data/hosts /system/etc/hosts
At that point, your system is setup to run adfree. On the first run of adfree, it will see the hosts file in /data/data and uses it.
I have use this method at least 10 times while trying out different roms:
Hell to the yes. gadget!'s method worked for me- I did not know NOT to use local IP and to NOT check the symlink button. Maybe someone can educate me on what those options mean?
Glad it worked out for you =). j/w, is the app that kept giving you religious ads "Android System Info"? For some reason the people behind that app have decided to lock the ad into messages about "Jesus" or "prayers"... I always thought that was kind of odd.
Adfree works without issue after running unrevoked forever. No symlink needed.
Sent from my ADR6300 using XDA App
bhazard451 said:
Adfree works without issue after running unrevoked forever. No symlink needed.
Sent from my ADR6300 using XDA App
Click to expand...
Click to collapse
Thanks for the info, came here to ask this question. Do I need to check symlink in the adfree setup?
gadget! said:
As stated in my earlier post, I have it working on my Incredible and it has worked for me on 4 different ROMS.
This may not work for you, but it does work for me. I found these tips awhile ago and don't remember where I found them.
NOTE: Notice the paths in the commands below - They differ from the original post.
Boot into clockwork recovery and launch adb shell.
Execute the following:
Code:
2. Install and run
3. allow it to download and install new hosts file, it will copy it to your sdcard and try to replace /system/etc/hosts but fail (it should reboot the phone shortly)
4. Power off the phone and hold Volume Down and power.
5. Use volume down to select recovery
6. In clockwork recovery volume down to "partitions menu" and hit the track pad to select
7. Select "mount /system" and "mount /sdcard" "mount /data"
8. Plug in your usb cord and open a command line on your pc
9. enter adb shell and type the following commands
cp /sdcard/hosts /data/hosts
rm /system/etc/hosts
ln -s /data/hosts /system/etc/hosts
Note the last command, that it a lowercase L not an I
a couple of others have made that mistake (for best results copy each command to your clipboard and paste it into your command prompt).
Reboot the phone and it should work now.
Use BTC IP and do not check symlink from /data/data/hosts
gadget!
Click to expand...
Click to collapse
This worked perfectly for me. Thanks.

Backup and Restore Galaxy Nexus without root (Mac)

UPDATED 2/3/12
Thanks to @copkay for writing this! http://forum.xda-developers.com/showthread.php?t=1420351 (windows version)
copkay said:
Like a lot of you, I have been putting off unlocking the bootloader on my Nexus because I didn't want to have to go through the hassle of backing up everything manually and restoring individual application data; logging back into apps; saving settings; etc. I found an undocumented (at least as far as my googling was able to find) feature in the latest version of the ADB platform tools (for Android 4.0+) that allows you to create a full system backup, including app apks, their respective data, as well as the internal storage.
This guide assumes you have already installed the Android SDK, and updated the Android SDK Platform Tools to the latest version (currently Rev 10) using the SDK Manager.
Click to expand...
Click to collapse
1. Connect your device via USB, and open Terminal.
2. In Terminal, type "cd " with the space and then drag your "platform-tools" folder in the android sdk where the space is, it should look like this "cd /where ever you put the folder/name of you computer/android-sdk-mac-osx/platform-tools". Drag and drop will do this for you, then hit enter.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
3. In the same terminal window, type "./adb" and hit enter. A lot of stuff with come up that you really dont need to worry about.
4. Optionally, type the command "./adb devices" to ensure that your device is properly recognized. If you're comfortable with ADB already, just skip this.
The command parameters format is:
./adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|nosystem] [<packages...>]
Click to expand...
Click to collapse
The most basic command you can use is simply:
./adb backup -all
Click to expand...
Click to collapse
This will use the defaults to backup only app and device data (not the APKs themselves) to the current directory as 'backup.ab'
To explain the parameters:
./adb backup -f <file>
Click to expand...
Click to collapse
Use this to choose where the backup file will be stored, e.g. '-f /backup/mybackup.ab', which will save it at the root of your drive (C:\ for Windows, etc.) in a folder called backup, as a file named 'mybackup.ab'. I recommend using this flag to set a location manually, as with my first backup test, it said that it completed successfully, but I was unable to locate the backup file. I have no idea where it was saved, but it wasn't where it should have been located.
./adb backup -apk|-noapk
Click to expand...
Click to collapse
This flags whether or not the APKs should be included in the backup or just the apps' respective data. I personally use -apk just in case the app isn't available in the Market, so that I don't have to go hunt it down again. The default is -noapk.
./adb backup -shared|-noshared
Click to expand...
Click to collapse
This flag is used to "enable/disable backup of the device's shared storage / SD card contents; the default is noshared.", which for the Nexus I would certainly flag to -shared, but from my test, it did not restore all of the contents of my internal storage, so I recommend backing up music, pictures, video, and other internal storage items manually, just to be on the safe side. The default is -noshared.
./adb backup -all
Click to expand...
Click to collapse
This flag is just an easy way to say to backup ALL apps. The packages flag (further on) can be used to choose individual packages, but unless you're just wanting to backup a specific application, use -all for a full system backup.
./adb backup -system|-nosystem
Click to expand...
Click to collapse
This flag sets whether or not the -all flag also includes system applications or not. I used -system, but this is probably unnecessary, and I would almost guess that it is safer to use -nosystem, but use your own judgment on this. The default is -system.
./adb backup <packages...>
Click to expand...
Click to collapse
Here you can list the package names (e.g. com.google.android.apps.plus) specifically that you would like to backup. Use this only if you're looking to backup a specific application.
3. Once you've made your decision on how to perform the backup, simply type the command as you would like it; in my case, this is the command that I used:
./adb backup -apk -shared -all -f /c/backup20111230.ab
or
./adb backup -apk -shared -all -----------and then just search for it in finder.
Click to expand...
Click to collapse
4. You will see a screen like the following:
5. Enter a password (if desired) for encryption of the backup file. RETAIN THIS PASSWORD FOR RESTORING LATER.
6. This process will take several minutes to complete, depending on the settings you've chosen, but when completed, you should get a toast on-screen saying 'Backup Complete', or if you miss that, you'll know once your command line has returned.
7. Now go unlock your bootloader (not going to go into the process for this guide, but you probably know how already, and if not, there are several guides a search away).
8. Once you're booted back into Android, you can choose to add your account now, or skip that for later. I skipped it for later, but I think it might make the process more smooth to sign in before the restore. YMMV.
9. To restore, with your device connected open your command prompt again, and type:
./adb restore /backup/mybackup.ab
Click to expand...
Click to collapse
replacing '/backup/mybackup.ab' with the location of your backup file.
10. You will see a screen like the one below:
11. Simply type in your current encryption password (if you've set one), and the password with which the backup was encrypted (if you chose to set a password), and the restore will begin. It again will take several minutes depending on the size of the backup and the options chosen.
12. You're back to normal, short of possibly some widgets on the home screen. My wallpaper was even restored, my app folders remained just as I had them before, my alarms remained, and for most applications, I didn't even have to log back in; it kept everything.
________________________
NOTE: I did have an issue with not all files being restored to the Internal Storage; in particular, the Gallery still displayed all the folders and files that it had cached (which it expected to be there) as only gray boxes, and would not display the images, nor would it rescan the media. I simply copied the files back to the Internal Storage directory manually, and all was well again. Again, YMMV.
NOTE : Also to note, this will not back up SMS messages, so if you're concerned about those, you may want to look into an alternative application to back up SMS.
Hope this is able to help! If so, give me a thanks )) and let me know how your experience goes.
- Sean
Worked
I couldn't get it to work no matter how much I tried. I could connect and see the device but when I ran the command, all I would get was a list of commands. I finally found a way upgrade the sdk by:
./android update sdk --no-ui
Then it worked perfectly!!
bosshoss16 said:
I couldn't get it to work no matter how much I tried. I could connect and see the device but when I ran the command, all I would get was a list of commands. I finally found a way upgrade the sdk by:
./android update sdk --no-ui
Then it worked perfectly!!
Click to expand...
Click to collapse
Ya in the beging when I said you need the sdk package, I forgot to say for all to be updated, whoops. Was that your problem?
Hipe0ples555 said:
Ya in the beging when I said you need the sdk package, I forgot to say for all to be updated, whoops. Was that your problem?
Click to expand...
Click to collapse
Yeah, after I updated the sdk, it worked perfectly! Thanks!!
I'm completely new to this. I downloaded the SDK manager and the Platform tools.
Terminal opened automatically with the manager. Then I did number 2 which worked fine.
After that when I type the commands from number 3 and 4 nothing happens when I hit enter. Any help would be appreciated.
Is it possible my Mac doesn't see the Nexus. Is the Nexus supposed On or Off by the way, I had it On.
ivoniko said:
I'm completely new to this. I downloaded the SDK manager and the Platform tools.
Terminal opened automatically with the manager. Then I did number 2 which worked fine.
After that when I type the commands from number 3 and 4 nothing happens when I hit enter. Any help would be appreciated.
Is it possible my Mac doesn't see the Nexus. Is the Nexus supposed On or Off by the way, I had it On.
Click to expand...
Click to collapse
Code:
./adb devices [enter]
Will tell you if its connected (per #3).
If #2 works properly and it navigates to your platform-tools folder, then you should be able to type ./adb [enter] and have all of th ADB commands come up. If not, you haven't properly updated/installed the SDK, or you haven't navigated to the folder properly.
martonikaj said:
Code:
./adb devices [enter]
Will tell you if its connected (per #3).
If #2 works properly and it navigates to your platform-tools folder, then you should be able to type ./adb [enter] and have all of th ADB commands come up. If not, you haven't properly updated/installed the SDK, or you haven't navigated to the folder properly.
Click to expand...
Click to collapse
Thanks for the fast reply. I've no idea what to do. I did install it, I'm not sure what - navigate properly means. I just did what it says.
Neither ./adb [enter] nor ./adb devices [enter] work, just nothing happens. Here is copy for the Terminal:
cd /Users/name/Desktop/android-sdk-macosx/platform-tools
./adb
./adb devices
If you have any ideas please let me know.
ivoniko said:
Thanks for the fast reply. I've no idea what to do. I did install it, I'm not sure what - navigate properly means. I just did what it says.
Neither ./adb [enter] nor ./adb devices [enter] work, just nothing happens. Here is copy for the Terminal:
cd /Users/name/Desktop/android-sdk-macosx/platform-tools
./adb
./adb devices
If you have any ideas please let me know.
Click to expand...
Click to collapse
when you type ./adb , does it run a long command line?
Hipe0ples555 said:
when you type ./adb , does it run a long command line?
Click to expand...
Click to collapse
No matter what I type nothing runs. Even when I try the update command from the SDK Readme.txt that came in the ZIP - "tools/android update sdk --no-ui" nothing happens.
Could there be something wrong with my Terminal.
ivoniko said:
No matter what I type nothing runs. Even when I try the update command from the SDK Readme.txt that came in the ZIP - "tools/android update sdk --no-ui" nothing happens.
Could there be something wrong with my Terminal.
Click to expand...
Click to collapse
Probably not, I would just try to delete the whole android_sdk folder and re-download it, even though it may take some time, it will be worth it if it works!
ivoniko said:
No matter what I type nothing runs. Even when I try the update command from the SDK Readme.txt that came in the ZIP - "tools/android update sdk --no-ui" nothing happens.
Could there be something wrong with my Terminal.
Click to expand...
Click to collapse
Probably not, just delete the whole Android_SDK folder and re-install everything! You know to go into the folder, go to tools and click android to updated all 6 things right?
Probably not, just delete the whole Android_SDK folder and re-install everything! You know to go into the folder, go to tools and click android to updated all 6 things right?
ivoniko said:
No matter what I type nothing runs. Even when I try the update command from the SDK Readme.txt that came in the ZIP - "tools/android update sdk --no-ui" nothing happens.
Could there be something wrong with my Terminal.
Click to expand...
Click to collapse
Did you see my other post, it is not showing up for some reason, is it working yet?
ivoniko said:
Thanks for the fast reply. I've no idea what to do. I did install it, I'm not sure what - navigate properly means. I just did what it says.
Neither ./adb [enter] nor ./adb devices [enter] work, just nothing happens. Here is copy for the Terminal:
cd /Users/name/Desktop/android-sdk-macosx/platform-tools
./adb
./adb devices
If you have any ideas please let me know.
Click to expand...
Click to collapse
One thing that I noticed, I had my Nexus plugged in through a USB hub, and I was seeing the same behavior you described. I then plugged it in directly into my laptop and I was able to see it. May or may not apply to your situation.
Alright so an update to my previous comment.
I was able to follow this guide and create a backup, unlock the boot loader and root the phone successfully. I am now in the process of restoring my backup, however when I type in:
./adb devices
in the terminal, nothing is listed. Therefore, I am unable to restore my back up. Any ideas on what may be going on?
EDIT: Figured it out, I forgot to re-enable USB debugging after my phone was wiped
Hipe0ples555 said:
Probably not, just delete the whole Android_SDK folder and re-install everything! You know to go into the folder, go to tools and click android to updated all 6 things right?
Click to expand...
Click to collapse
Yes, I went to tools, clicked on android, updated 6 things and after that when I entered the commands nothing happened.
In any case I will listen to your advice and download everything again.
Entering commands in terminal doesn't work. Even before having to conect the phone just entering the update commands in terminal doesn't do anything. I have no clue.
Here it is how it looks -
Last login: Tue Jan 31 00:53:34 on ttys000
/Users/name/Desktop/android-sdk-macosx/tools/android ; exit;
Name-MacBook-Pro:~ name$ /Users/name/Desktop/android-sdk-macosx/tools/android ; exit;
tools/android update sdk --no-ui
./android update sdk --no-ui
ivoniko said:
Thanks for the fast reply. I've no idea what to do. I did install it, I'm not sure what - navigate properly means. I just did what it says.
Neither ./adb [enter] nor ./adb devices [enter] work, just nothing happens. Here is copy for the Terminal:
cd /Users/name/Desktop/android-sdk-macosx/platform-tools
./adb
./adb devices
If you have any ideas please let me know.
Click to expand...
Click to collapse
Ok, so it is not literally; cd /Users/name/Desktop/android-sdk-macosx/platform-tools if thats not where it is; in terminal just type "cd " then just drag the platform-tool folder into the terminal and you should get something that LOOKS like cd /Users/name/Desktop/android-sdk-macosx/platform-tools but if thats not where it is, it will have a different path. Does that help?
ivoniko said:
Entering commands in terminal doesn't work. Even before having to conect the phone just entering the update commands in terminal doesn't do anything. I have no clue.
Here it is how it looks -
Last login: Tue Jan 31 00:53:34 on ttys000
/Users/name/Desktop/android-sdk-macosx/tools/android ; exit;
Name-MacBook-Pro:~ name$ /Users/name/Desktop/android-sdk-macosx/tools/android ; exit;
tools/android update sdk --no-ui
./android update sdk --no-ui
Click to expand...
Click to collapse
You forgot to type cd*space*, "cd " before draging the folder into the terminal.
Just updated everything! Does the change help?

[Q] help with adb pull [Solved]

so my wife dorpped her s3 and broke the screen, the phone is rooted and i have adb debugging turned on i can use adb to pull/puch etc. but i dont know how, could some on tell me what adb commands i need to issue to the device to pull her internal sd data to my computer and push it back to her new s3, i also need to know how to wipe her phone with adb and reset to stock so i cna return it to the insurancce company, if anyone could tell me how to basically pull everything from her phone, internal sd data, and her text messages i know to pull the texts and view them i will need to use sqlite 3 to view the .db of her text messages but i cant figure out the commands to do so and i cant figure out how to format the commands so that it will pull the info to my desktop for viewing through sqlite 3 on the computer, also if i need to install sqlite 3 on the device with adb i need to know the commands for that as well, all help is welcomed, i have to get this thing back to stock in the next week or so, you are even more than welcome to call me an idot noob because i really am, i am very technically inclined and can follow complex instructions provided they are complete, please help ! lastly is there an adb command that would transfer what should be displayed on the screen if it worked within a emulator window if so please include that information as well.
This has been solved thanks to the info that was given, i was able to wrap my head around the entireity of adb, and my actual problem was not formatting of commands, my wife had a lock screen so i had to get that unlocked before adb would allow pulls if you need to do this with you phone i have posted a tutorial in the android general development and hacking [developers only] forums
MotoDefier said:
so my wife dorpped her s3 and broke the screen, the phone is rooted and i have adb debugging turned on i can use adb to pull/puch etc. but i dont know how, could some on tell me what adb commands i need to issue to the device to pull her internal sd data to my computer and push it back to her new s3, i also need to know how to wipe her phone with adb and reset to stock so i cna return it to the insurancce company, if anyone could tell me how to basically pull everything from her phone, internal sd data, and her text messages i know to pull the texts and view them i will need to use sqlite 3 to view the .db of her text messages but i cant figure out the commands to do so and i cant figure out how to format the commands so that it will pull the info to my desktop for viewing through sqlite 3 on the computer, also if i need to install sqlite 3 on the device with adb i need to know the commands for that as well, all help is welcomed, i have to get this thing back to stock in the next week or so, you are even more than welcome to call me an idot noob because i really am, i am very technically inclined and can follow complex instructions provided they are complete, please help ! lastly is there an adb command that would transfer what should be displayed on the screen if it worked within a emulator window if so please include that information as well.
Click to expand...
Click to collapse
I'm not going to call you an idiot noob. It seems to me that you know a little more than you express. A few Google searches could answer all of your questions. You are asking for someone to write you a novel, it's not going to happen.
Aerowinder said:
I'm not going to call you an idiot noob. It seems to me that you know a little more than you express. A few Google searches could answer all of your questions. You are asking for someone to write you a novel, it's not going to happen.
Click to expand...
Click to collapse
google has actually been un helpful in this dilema, however I think the explaination of adb commands on the sdk's page looks like it has enough information for me to write, my own novel (lol) so I will start there tonight, and hope that I understand the procedures described as well as I think I do, thanks for the reply anyway
Now that I have a little more information I guess what I really was trying to ask is for someone to give me a little better understanding of how issuing commands work I know how to issue ADB commands for instance with ADB HELP OR HELP ALL the command looks like this in the example. Adb pull [<local>] [<remote>] i dont understand what information adb is looking for where it says local and remote, is adb looking for me to type the [<local>] [<remote>] exactly this way or is it leading me to give a path for local and a path for remote, if so how do i go about figuring out said paths?
Sent from my ASUS Transformer Pad TF300T using xda app-developers app
Local would be path on pc, remote would be path on phone.
sorry, for asking probably dumb questions
Aerowinder said:
Local would be path on pc, remote would be path on phone.
Click to expand...
Click to collapse
I know that it sounds stupid that i know how to open adb, i know how to issue commands (mostly) and i know that you said you think i know more than i am taking credit for, but heres the thing i do know ALOT about computers and can do almost anything with them however Command line utilities is not my strong suit, so local is the path on the pc remote is the path on the phone i am assuming that this would be the proper way to pull the sd data
adb pull -shared [< / sd>] [< C:\user agentlogon\Desktop>] if i wanted to store the file on my desktop would that be correct or am i just completly command line retarted? , i know that this isnt the real path but if it were is this correct formatting for the command line?
Like this: adb pull -shared "/sd" "C:\user agentlogon\Desktop"
Adb kill-server
Adb start-server
Adb pull <file> <Local>
Sent from my LT26i using xda app-developers app
Aerowinder said:
Like this: adb pull -shared "/sd" "C:\user agentlogon\Desktop"
Click to expand...
Click to collapse
Ok, so sorry, at this point i feel like a total idiot and im sure if your not right there with me your getting close, but i think this last question will help me understand command line utils better in the future, so when you see [<>] am i correct that the utility is showing me its okay to perform said command on [ ] directories <> files ? Also i am a very literal learner so do i use the quotes on the command or are you just quoting me?
[<>] = variable. Replace the entire sequence. So, [<local>] = "C:\directory\file.ext" This is not standardized across commandline apps. The [<>] is only meant to show the user that they need to replace this with his/her own value.
In commandline utilities, spaces separate commands, this is why you need quotations around directories that have spaces. If you don't, the C:\... directory will be interpreted as two seperate commands, resulting in a syntax error. I always use quotations around directories out of habit. / is often used as a switch. To be safe, always quote directories. This is standardized across all commandline apps.
TrinityHaxxor said:
Adb kill-server
Adb start-server
Adb pull <file> <Local>
Sent from my LT26i using xda app-developers app
Click to expand...
Click to collapse
Yeah i got the kill start sever on lock, and i am wanting to pull thecentire contents of the sd, not a single file, but thanks for your input it is all welcomed!
Aerowinder said:
[<>] = variable. Replace the entire sequence. So, [<local>] = "C:\directory\file.ext" hhis is not standardized across commandline apps. The [<>] is only meant to show the user that they need to replace this with his/her own val
In commandline utilities, spaces separate commands, this is why you need quotations around directories that have spaces. If you don't, the C:\... directory will be interpreted as two seperate commands, resulting in a syntax error. I always use quotations around directories out of habit. / is often used as a switch. To be safe, always quote directories. This is standardized across all commandline apps.
Click to expand...
Click to collapse
now i have a new problem it is saying /sd does not exist do you possibly have a screenshot of the path for the sd in a file manger you could post for me if not i will try to look at it with my wifes new phone and hope that the stock file system is the same as the modded system she has on the broken phone. also if this doesnt work how would i just do a full wipe of the phone so it looks like i just wiped it for privacy.
Try:
/storage/sdcard
/storage/sdcard0
/mnt/sdcard
/mnt/sdcard0
One of those should work.
Aerowinder said:
Try:
/storage/sdcard
/storage/sdcard0
/mnt/sdcard
/mnt/sdcard0
One of those should work.
Click to expand...
Click to collapse
IIts not giving me any errors, but its not giving me the files either, i tried to adb root to see if that would change and it says adbd cannot run as root in production builds, i tried to adb remount it says opperation not permitted, i tried adb shell then su and adb freezes and wont let me exit shell, it either freezes or just echo's what i type, so if i type exit it returns exit showing the word exit twice but leaves me no choice other than to close cmd and re open and restart adb, not sure what im doing wrong, the device show with adb devices in adb and shell but then says device not found when i try to su in shell lol, fml!

[GUIDE] Backing up a phone with broken display

I have seen several of threads asking about how to recover data from a phone that has a broken display.
Backing up a phone with broken display
Prerequisites
Rooted phone with broken display/digitizer/etc. Display is nonfunctional for whatever reason.
ADB for your platform. Downloads for Windows, Mac, and Linux can be found at my dev-host.
Drivers installed (Windows), rules file set up (Linux + Mac). Drivers for windows can be found here. Rules file for Linux can be found here.
Recovery file attached to this post. (twrp.img)
External sdcard with at least 2 GB free space inserted in your broken phone.
openrecoveryscript.txt file attached to this post.
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Backing up your broken device
Extract the ADB zip somewhere convenient.
Move the twrp.img recovery file into the ADB extracted directory.
Move the openrecoveryscript.txt file into the ADB directory.
Open a command prompt / terminal window in the ADB directory.
Windows: Windows Key + R => Type in "cmd" then click "RUN".
Linux: Open a terminal window by selecting it from your applications.
ALL:
Code:
cd /path/to/ADB/directory
Pull the battery from your phone, place it back in and boot into recovery (VolUp + Home + Power).
Connect your phone to your computer
Make sure that the following command returns "XXXXXX recovery" before proceeding to the next step.
Code:
./adb devices
Expected output:
Code:
List of devices attached
XXXXXXX recovery
Now to install TWRP recovery to your device. Type the following commands ( after each line). Linux users: Make sure you prepend each command with "./", as in "./adb ...". ALL Make sure you type the commands in CAREFULLY.
Code:
adb push twrp.img /tmp/twrp.img
adb shell dd if=/tmp/twrp.img of=/dev/block/mmcblk0p18
Wait until the last command above returns an output similar to below before proceeding to the next step:
Code:
12916+0 records in
12916+0 records out
6612992 bytes (6.3MB) copied, 1.094278 seconds, 5.8MB/s
Now pull your phones battery and reboot into recovery once again.
Run the following command to make sure your phone has booted into recovery completely.
Code:
adb devices
Expected output
Code:
List of devices attached
XXXXXXX recovery
Type the following to set up a script that will backup your phone to your external sdcard.
Code:
adb push openrecoveryscript.txt /cache/recovery/openrecoveryscript
Reboot your phone once more. This time, TWRP will begin backing up your ROM.
Wait for the backup to finish. You will know it is finished when you feel your phone reboot once more.
Optionally, you can check the state of your backup by running the following command and reading the last couple lines of it's output.
Code:
adb shell cat /tmp/recovery.log
Click to expand...
Click to collapse
Click to expand...
Click to collapse
That's it! Your entire system (/system, /data, /cache, and boot) will be backed up to your external sdcard. Just pop the sdcard in your replacement phone and you're good to go.
Enjoy and donate to the TWRP devs! This would not be possible if TWRP did not use the OpenRecoveryScript scripting engine!
Don't forget to attach your script.txt file!
Also, I was thinking if its easy enough to just edit your existing script, maybe post ones that can wipe data/factory reset and possibly some other functions available in TWRP?
Sent from my SGH-T999 using xda premium
DocHoliday77 said:
Don't forget to attach your script.txt file!
Click to expand...
Click to collapse
Ah, whoops! Files can be found here until I can get to a computer: http://forum.xda-developers.com/showthread.php?p=43332650
The Thanks button is just to avoid "THANKS" posts in threads. Nothing more. Don't defeat the purpose of why it was introduced.
DocHoliday77 said:
Also, I was thinking if its easy enough to just edit your existing script, maybe post ones that can wipe data/factory reset and possibly some other functions available in TWRP?
Click to expand...
Click to collapse
I don't want to reinvent the wheel, but there areapps that can do that I'll post a couple scripts later though :thumbup:
The Thanks button is just to avoid "THANKS" posts in threads. Nothing more. Don't defeat the purpose of why it was introduced.
CNexus said:
I don't want to reinvent the wheel, but there areapps that can do that I'll post a couple scripts later though :thumbup:
The Thanks button is just to avoid "THANKS" posts in threads. Nothing more. Don't defeat the purpose of why it was introduced.
Click to expand...
Click to collapse
Which apps? I'm currently in a position where I need to erase my phone but the screen doesn't work.
porfymartinez said:
Which apps? I'm currently in a position where I need to erase my phone but the screen doesn't work.
Click to expand...
Click to collapse
Ah. Replace the text inside the openrecoveryscript.txt with this following
Code:
wipe data
wipe cache
wipe dalvik
wipe system
Optionally, add the following (to the script I wrote above) to wipe your internal storage.
Code:
mount data
cmd rm -r /data/media
The Thanks button is just to avoid "THANKS" posts in threads. Nothing more. Don't defeat the purpose of why it was introduced.

Data Recovery via Download Mode

Afternoon all,
My G4 has hit the bootloop for the last few days. Periodically, it has powered up to the main screen, but not for long enough for me to recover data.
I just spoke to a data recovery place that told me that if I can put my phone into download mode, they can recover the data. Lo and behold, my phone is currently next to me in download mode!
I'm quite keen to avoid dropping that amount of money if possible, so does anyone know of a way to recover the internal memory of the phone via download mode?
Apologies if I'm duplicating a previous thread - I had a quick look, but couldn't see any with the same issue.
Probably when the phone is in download mode they can copy the partitions bit by bit then try to do data recovery from those partition images.
So if the phone doesn't boot, it doesn't mean the data partition is corrupted so in theory you could try to copy the data partition and mount it and see what files you can recover.
I do not know the exact commands to dump the data partition but I think that's the way it can be done.
Anyone else willing to give a hand here?
Thanks for the help so far. I believe the data is intact - when the phone starts up, the data is all there. It's just accessing it that is the issue.
Sent from my Nexus 5 using Tapatalk
something similar to
Code:
dd if=/dev/block/mmcblk0p55 bs=8192 skip=65536 count=548352 of=/mnt/media_rw/external_SD/data.img
OR
Code:
dd if=/dev/block/mmcblk0p55 bs=8192 skip=65536 count=548352 of=/dev/block/mmcblk1/data.img
don't quote me on that but in theory this should work...
make SURE you have a 32gb SDCard in the phone first
Where would that command be entered mate? Sorry, only ever used my phone stock before.
Sent from my Nexus 5 using Tapatalk
I thought the OP title said download mode?
Use the LG Root method as if you were going to root..
I'm mobile ATM but if I remember correctly...
Send_Command \\.\Com# [# meaning your com port number]
Then insert that command.
Tomorrow at work I can get a common list of partition names and the command to back it up with.
je2854 said:
I thought the OP title said download mode?
Use the LG Root method as if you were going to root..
I'm mobile ATM but if I remember correctly...
Send_Command \\.\Com# [# meaning your com port number]
Then insert that command.
Tomorrow at work I can get a common list of partition names and the command to back it up with.
Click to expand...
Click to collapse
You need to mount the partition first.
Also, you could mount data if it is not encrypted (is it?)
Do this:
Code:
mkdir /temp
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
A little tip that should work :
Take the battery off your phone
Put both phone and battery in the fridge
Wait till the phone is cold and boot the device.
The bootloop trouble is due to an abnormal warm so this way you can have a one shot normal boot to backup your data before send for warranty.
terisse said:
A little tip that should work :
Take the battery off your phone
Put both phone and battery in the fridge
Wait till the phone is cold and boot the device.
The bootloop trouble is due to an abnormal warm so this way you can have a one shot normal boot to backup your data before send for warranty.
Click to expand...
Click to collapse
If you try this, please put the phone in a ziploc bag 1st and seal it so humidity won't get inside the phone while in the fridge.
nagalun said:
You need to mount the partition first.
Also, you could mount data if it is not encrypted (is it?)
Do this:
Code:
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
Click to expand...
Click to collapse
just a question though... How can you use this command if it will not boot?
---------- Post added at 08:59 AM ---------- Previous post was at 08:50 AM ----------
to get into download mode do the following...
Pull Battery
Hold Volume Up
Plug in USB Cable (make sure it's plugged in the computer)
Release button after 5 seconds
follow the link to grab the files needed for "Send_Command"
Grab LG Root here
once you are in the mode and you followed directions you can copy the command I wrote
above to copy your data partition. The reason you must have a 32gb+ SDCard is you will
be making an exact copy of the /data partition where you can remove the SDCard and recover
whatever is needed.
je2854 said:
just a question though... How can you use this command if it will not boot?
Click to expand...
Click to collapse
Hmm... With the Send_Command.............? dd is a command too :silly:
nagalun said:
Hmm... With the Send_Command.............? dd is a command too :silly:
Click to expand...
Click to collapse
there is no need to mount the partition first..
the dd command will copy the partition as a RAW image.
you must then take it to a computer and mount it as an EXT4 or use it with ext2explore
je2854 said:
there is no need to mount the partition first..
the dd command will copy the partition as a RAW image.
you must then take it to a computer and mount it as an EXT4 or use it with ext2explore
Click to expand...
Click to collapse
in that case the command you have given him will copy 4492 mb only.
Here is why:
Code:
dd if=/dev/block/mmcblk0p55 bs=8192 skip=65536 count=548352 of=/dev/block/mmcblk1/data.img
input_file=(some partition) block_size=8192 skip_this_much_data=65536 how_many_data=548352 output_file=(somewhere)
actual data copied is 8192 * 548352 = 4492099584 bytes, and you are skipping some data from the beggining with 'skip'
you do still need to mount the sdcard, the "mmcblk1" is not treated as a directory, and it is very unlikely the sd card is mounted automatically in download mode.
nagalun said:
in that case the command you have given him will copy 4492 mb only.
Click to expand...
Click to collapse
remember me saying (if you read) above that I said "something similar to"
Hi all. Firstly, thanks for all your responses!
I've not got much of a clue what I'm doing unfortunately, I've never really messed with Android before - I'm typically fairly computer literate, but I've steered clear of messing with and rooting phones for the most part.
So to clarify, I've downloaded LG Root, Running either of the exes just leads to a cmd box that's open for about a second before closing, so I'm presuming I've missed a step. Is there a guide already in existence on how to use it?
But once in, ensure there's a sizeable Micro SD card in (it's a 64gb so I should be okay!) and use the send_command exe to send:
Code:
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
And then the entire image should be on the Micro SD card.
How would I then mount the data image to be readable? I've only used .iso for mounting before.
Apologies for my ignorance - I'm probably making helping me quite difficult!
Sorry all, correction to my previous:- Do I basically follow http://forum.xda-developers.com/android/development/guide-root-method-lg-devices-t3049772
And replace step 10 with the above command?
Shift+Right Click the folder you extracted "open command prompt here" for starters...
Run ports.bat first...
It'll tell you your DIAG and communication port...
The second com port is the one you are looking for.
Send_Command \\.\Com"#" (don't insert quotes, # being the number you found)
je2854 said:
Shift+Right Click the folder you extracted "open command prompt here" for starters...
Run ports.bat first...
It'll tell you your DIAG and communication port...
The second com port is the one you are looking for.
Send_Command \\.\Com"#" (don't insert quotes, # being the number you found)
Click to expand...
Click to collapse
I'm having the same issue and actually tried this earlier today. Ports.bat didn't show a DIAG communication port even when I had the phone stably sitting in Download Mode.
Going to try the freezer trick. I already bought a Nexus 6P, just want to unlock the locked content on my SD card. lol.
EDIT: Holy crap! It worked. I chilled it in a baggie, then stood in front of the freezer as I unlocked all of my locked gallery files (1,411 files totaling 900MB). As soon as I was done, 30 seconds after stepping away from the freezer, it started to bootloop again.
Got the only information I needed off my phone...nice! I might give it another go tomorrow and see if I can't run ROM Toolbox and backup all my apps so it'll be easier to push to my N6P.
Awesome suggestion!
IlyaKol said:
I'm having the same issue and actually tried this earlier today. Ports.bat didn't show a DIAG communication port even when I had the phone stably sitting in Download Mode.
Going to try the freezer trick. I already bought a Nexus 6P, just want to unlock the locked content on my SD card. lol.
EDIT: Holy crap! It worked. I chilled it in a baggie, then stood in front of the freezer as I unlocked all of my locked gallery files (1,411 files totaling 900MB). As soon as I was done, 30 seconds after stepping away from the freezer, it started to bootloop again.
Got the only information I needed off my phone...nice! I might give it another go tomorrow and see if I can't run ROM Toolbox and backup all my apps so it'll be easier to push to my N6P.
Awesome suggestion!
Click to expand...
Click to collapse
Mine will only get to optimising Apps, even if still in the freezer.
Sent from my Nexus 5 using Tapatalk
Hi all, sorry for the double posting, but just to make certain before I do something that will accidentally brick my phone. I'm intending to do the following:
Put phone in download mode and connect device.
Open LG_Root folder
Run a command window in LG_Root
Code:
Send_Command.exe \\.\Com4
Then, line by line, command:
Code:
mkdir /temp/sd /temp/data
mount /dev/block/mmcblk1p1 /temp/sd
mount /dev/block/bootdevice/by-name/userdata /temp/data
mkdir /temp/sd/recoverydata
cp -R /temp/data/media/ /temp/sd/recoverydata/
Once I've done all this, what happens next? Will I see responses on the screen etc?
Again, I apologise for the probably stupid questions. I don't want to brick my phone and lose all of the data, but I'm going away with work so would like to square it before I go if I can.
Many thanks to you all so far.

Categories

Resources