[HOW TO] Fully Backup & Restore Android Device - Android General

NOTE:
I'm not a developer or something even near to that. I'm a newbie and will be, seems so. All information provided here is copied and compiled from different internet sources. This information is according to best of my knowledge and comprehension and is just for curious souls like me who want to understand things in quite simple words.
I have tested this on different devices. I'll not be responsible for any harm to you or your device. It works perfectly for me. You may try it on your own risk.
Encrypted memory may cause problem in backing up and restoring data. So better decrypt it before proceeding. Or the Recovery should support decryption of /data partition.
WHY YOU NEED TO BACKUP YOUR DATA
For security, in case if device is lost. Read here more about the risks.
If you are going to change your device.
If your device is running out of memory space.
If your device is slowing down or giving random errors and you want a clean start i.e. by factory data reset.
If you are upgrading your Factory Firmware or ROM (OS).
If you are a curious soul like me and interested in experimenting with device.
WHAT TO BACKUP
Backup is a broad term used in many contexts.
PERSONAL DATA
On an android device, backing up personal data like pictures, music, videos, documents, e-books etc. means backing up Internal Memory (/data/media/) and SD card (if you use one). If you have disabled internal memory (D.I.M), your SD Card would be working as Internal Memory.
Personal data might be created by apps (like Camera, Facebook, WhatsApp etc) or imported from internet or other devices by yourself.
APPS & APPS DATA
If you are upgrading your ROM permanently, you might be interested in backing up your apps and their data as well. So that you don't lose important data and don't have to install apps again. System apps are stored in different folders under /system/ while user apps under /data/.
Apps typically store their data in /data/data/ but it's not a rule. Many apps save / backup their data on Internal Memory and/or SD Card as well. That's why you see folders named 'Android', 'data' etc. on Internal Memory and SD Card. Also, there are numerous folders named after app names. These folders may contain Personal Data as well, created by that certain app.
Contacts and messages are also stored in their default apps' data folder i.e. in /data/data/ and are not usually backed up manually.
OPERATING SYSTEM & APPS & APPS DATA
If you are going to install new ROM temporarily, you may want a complete backup so that you don't have to go through the hassle of installing apps and setting up / personalizing your device again. It usually includes /system, /boot and /data partitions.
OS consists of SYSTEM and BOOT. While user apps & apps data is stored in DATA.
PARTITION IMAGES
From a developer's perspective, one may want to backup the whole device partitions, in case if something goes wrong during experimenting.
Read here more about android partitions.
WHERE TO BACKUP
INTERNAL MEMORY (/sdcard) (/storage/sdcard0) (/data/media/0)
This memory can be used to save data if you are not going to wipe / clean it. A Factory Data Reset usually doesn't wipe this but it can. It depends on the device. Similarly, Recoveries usually don't wipe internal memory but you can manually do so. However, formatting /data would certainly erase internal memory. Formatting might be a part of flashable zip if you are going to install new ROM. Flashing Factory Firmware using flasher will also erase internal memory.
EXTERNAL SD CARD (/external_sd) (/storage/sdcard1)
This is a more safer place to save / backup data because it is not wiped unless done manually or accidentally.
PERSONAL COMPUTER (USB Flash drive or Internal / External Hard Disk)
This is the safest place to keep data with abundant space and the least chances of losing / corrupting data.
ONLINE / CLOUD STORAGE
Some apps, including Google offer backing up your data online and auto-synchronizes it. You should certainly avail this option particularly for sensitive and light weight data like contacts, messages, documents, saved passwords, bookmarks, financial transactions etc. WhatsApp also has a good online backup option. You can use apps like Drive, SMS Backup & Restore, FolderSync, KeepSafe etc. to better utilize this option. But technically, this is a limited option.
HOW TO BACKUP
FILE EXPLORER APPS
You can use a file explorer like ES Explorer or Solid Explorer to manually copy files from, say, Internal Memory to SD Card to back it up.
BACKUP APPS
Some default apps have built-in feature to backup data and settings locally and online e.g. GO-SMS, Tasker etc. You can check apps for this feature.
Also, special backup apps like Titanium Backup can backup almost all of your user and system apps and their data. It can also backup contacts, messages, device settings etc. It can create a flashable zip of backed up data to flash through recovery. However, backups from one ROM may not fully work with other ROM's.
CUSTOM RECOVERY
Backing up data when ROM is running isn't safe. When files are being used by OS, they might not be written / read sometimes. So, a custom recovery is the best option to backup/restore data. Custom recoveries (TWRP/CWM) can backup / restore partitions SYSTEM, BOOT and DATA (excluding internal memory) for sure. Some new recoveries offer backing up more (or all) partitions on device. You can choose where to save backup files i.e. Internal Memory or SD Card. Then you can transfer these files to PC as well.
You can also use recovery's File Explorer to copy Internal Memory to SD Card. However, it's a slower process if you have a large number of files to backup.
PC
You can use PC in multiple ways to backup/restore data within device or from/to PC.
First of all, you will often come across different software advertised on net claiming to fully backup your device when connected to PC. They work but are not much useful / reliable according to my experience. Give them a try, if you want to.
Secondly, you can use USB cable to directly connect your device (as MTP in ROM or recovery) to PC or use apps like Wi-Fi File Transfer to wirelessly connect (in ROM) and then explore Internal Memory and SD Card. FTP or SFTP (SSH) server may also be setup on Android to remotely access it from PC if both are on same network.
Thirdly, you can mount SD Card as flash drive (UMS in ROM) or switch off your device, remove SD Card and then insert directly into PC through card reader to manually copy files. This method is faster, to copy large data. However, mounting as UMS in running ROM isn't recommended, particularly if you are using D.I.M. It will crash apps.
In Android 5+ UMS may not be available in USB settings as it has been deprecated in favor of MTP to avoid problems. However, to copy large data from internal SD card is really problematic without direct USB connection. Or what if we need to recover accidentally deleted data from internal memory? We can directly attach internal memory (as in UMS) to PC by a little hacking.
Fourthly and ultimately, like a boss , you can use life saving ADB feature of android to backup/restore your data as well as recovering your device from difficult situations and doing a lot of stuff. It's the best and fastest method to backup Internal Memory to SD Card and then restore (COPY WHOLE FOLDER (within device)). Or you can COPY WHOLE FOLDER (From/To PC) or COPY WHOLE PARTITION IMAGE (within device) or BACKUP / RESTORE APPS & DATA (From/To PC) in seconds.
Read here more about android partitions.

Another application that you can use to backup your phone to computer is Apowersoft Phone Manager. This works greatly in managing your devices plus it make sure that all your files are secured from being corrupted or loss.

doublematteo said:
Another application that you can use to backup your phone to computer is Apowersoft Phone Manager. This works greatly in managing your devices plus it make sure that all your files are secured from being corrupted or loss.
Click to expand...
Click to collapse
I can't determine the efficiency of the Apowersoft tool, but if you want to backup data , this is right way , after the phone data is backuped ,you don't have to worry about the deleted data unable be recovered back ,
The backup files is the best way to recover deleted data from phone

Kindly guide me on restoring app data alone from a nandroid to newer version of an app..
The scenario is that ,I upgraded to a higher android OS but find some of my apps(with no cloud storage),restored from my nandroid ,crashing; probably prompted by the change in OS.
I downloaded the compatible version of the app from playstore,but am clueless how to sync restored app data from nandroid to this version.

DIGVIJAY24 said:
Kindly guide me on restoring app data alone from a nandroid to newer version of an app..
The scenario is that ,I upgraded to a higher android OS but find some of my apps(with no cloud storage),restored from my nandroid ,crashing; probably prompted by the change in OS.
I downloaded the compatible version of the app from playstore,but am clueless how to sync restored app data from nandroid to this version.
Click to expand...
Click to collapse
Would you please mention apps names? Don't uninstall previous version. Just install compatible version over it. It should automatically have previous app data.

The backup program is much simpler than the android recovery program,

I came here looking for the best way to back up my internal storage before activities like flashing a new ROM or firmware. Previously, I'd plug my phone into my PC and just drag and drop the internal storage partition to a folder on my computer, but I'd often have to do it a few times because some file would get hung up, or the phone would randomly disconnect (even though my phone, cables, and computer are all new and high quality).
I'm currently using the TWRP file explorer to copy /sdcard to /external-sd/!InternalBackup, but there is no running log or progress indicator... So, this approach is less than ideal.
I'm still looking for the best method (not necessarily a software that will do it for me) that will do it fast, not get interrupted, and provide good feedback on if it's working and how much longer it will take. (The TWRP method above checks the first 2 criteria, but the 3rd is woefully insufficient.
I'm thinking that the best way to back up the internal SD will be in recovery, otherwise something might be in use and will halt the process.
Any suggestions?

DrPhant0m said:
I came here looking for the best way to back up my internal storage before activities like flashing a new ROM or firmware. Previously, I'd plug my phone into my PC and just drag and drop the internal storage partition to a folder on my computer, but I'd often have to do it a few times because some file would get hung up, or the phone would randomly disconnect (even though my phone, cables, and computer are all new and high quality).
I'm currently using the TWRP file explorer to copy /sdcard to /external-sd/!InternalBackup, but there is no running log or progress indicator... So, this approach is less than ideal.
I'm still looking for the best method (not necessarily a software that will do it for me) that will do it fast, not get interrupted, and provide good feedback on if it's working and how much longer it will take. (The TWRP method above checks the first 2 criteria, but the 3rd is woefully insufficient.
I'm thinking that the best way to back up the internal SD will be in recovery, otherwise something might be in use and will halt the process.
Any suggestions?
Click to expand...
Click to collapse
Commandline solutions are always best. You have better control over them. Use TWRP built-in terminal to run commands.
Simply 'cp' with verbose option "-v" is what fulfills your needs. 'rsync' is better if you want to save time by automatically skipping unchanged existing files. If you want to preserve file attributes and permissions, use 'tar'. Added compression can be achieved by 'xz' or '7za'. All of these commands are stable solutions, with high speed and ability to handle/resume broken/interrupted operations.
TWRP comes with busybox bundled. Busybox utilities have limited functionality and mostly suffice the need but rarely we face unexpected behavior. Instead you can use full static binaries of these commands.
Typing lengthy commands in TWRP shell terminal is somewhat challenging. Either use 'adb shell' or for repeated use, create a shell script and place it in internal memory or SD card. Or you can unpack TWRP image and save script in /sbin directly to run it just as a normal command. Another easy way is to create a flashable zip of your script. This way you can also see progress bar moving if you write a proper script for it.
Hope it helped.

mirfatif said:
Commandline solutions are always best. You have better control over them. Use TWRP built-in terminal to run commands.
Simply 'cp' with verbose option "-v" is what fulfills your needs. 'rsync' is better if you want to save time by automatically skipping unchanged existing files. If you want to preserve file attributes and permissions, use 'tar'. Added compression can be achieved by 'xz' or '7za'. All of these commands are stable solutions, with high speed and ability to handle/resume broken/interrupted operations.
TWRP comes with busybox bundled. Busybox utilities have limited functionality and mostly suffice the need but rarely we face unexpected behavior. Instead you can use full static binaries of these commands.
Typing lengthy commands in TWRP shell terminal is somewhat challenging. Either use 'adb shell' or for repeated use, create a shell script and place it in internal memory or SD card. Or you can unpack TWRP image and save script in /sbin directly to run it just as a normal command. Another easy way is to create a flashable zip of your script. This way you can also see progress bar moving if you write a proper script for it.
Hope it helped.
Click to expand...
Click to collapse
That's a lot of help... But I lack the basic understanding and experience to make use of it all. I'll have to Google it a bit and look at some examples. Thanks!
UPDATE: I did a little research, and I succeeded in using "cp" to do a test move in TWRP (I had to use -r and -v), but even using -v didn't create a progress bar or any indication that files were being moved. It just finished and went to the next new line. Is this expected?
Also... my version of TWRP doesn't seem to have rsync available. When I try to use rsync in TWRP, I get
Code:
sh: rsync: not found
So it seems that TWRP's terminal doesn't have rsync. I'm using TWRP 3.0.2-1
So... I'm currently using the Termux app to do the cp operation. I'd prefer to use rsync, which is supported in Termux, however, unless I do "su" first, it says it doesn't have access to the destination folder. And, when I use "su" I can't use rsync. I get pretty much the same message as when I try to use it in TWRP... something like "rsync not found"
Does this mean that when Termux is using root, it can't use rsync? Does that make sense?
Any help?
Thanks!

DrPhant0m said:
I did a little research, and I succeeded in using "cp" to do a test move in TWRP (I had to use -r and -v), but even using -v didn't create a progress bar or any indication that files were being moved. It just finished and went to the next new line. Is this expected?
Click to expand...
Click to collapse
'cp -r' copies recursively i.e. files/directories under directories and so on. So it's definitely required if you want to copy directories. 'cp -v' shows each file which is being copied, but not the progress during a single file copying. Check 'cp --help' for options.
Also... my version of TWRP doesn't seem to have rsync available. When I try to use rsync in TWRP, I get
Code:
sh: rsync: not found
So it seems that TWRP's terminal doesn't have rsync. I'm using TWRP 3.0.2-1
Click to expand...
Click to collapse
TWRP uses busybox which doesn't have rsync built-in. You can get a copy of static (independently working) rsync binary from many sources like this. Aarch64 will be a bit faster. Check 'getrpop | grep ro.product.cpu' to find your CPU architecture if it's 64-bit or 32. When in TWRP, place binary in /sbin directory. Then do 'chmod 0777 /sbin/rsync' to make it executable. Now you can use rsync. 'rsync --help' will show you options and basic help. Do note, /sbin is on volatile filesystem i.e. it will be gone on reboot. Don't expect it to be permanently there. You can also use rsync from other locations like sd card but that will need to call binary with full path and filesystem may put restrictions on execution.
So... I'm currently using the Termux app to do the cp operation. I'd prefer to use rsync, which is supported in Termux, however, unless I do "su" first, it says it doesn't have access to the destination folder. And, when I use "su" I can't use rsync. I get pretty much the same message as when I try to use it in TWRP... something like "rsync not found"
Does this mean that when Termux is using root, it can't use rsync? Does that make sense?
Click to expand...
Click to collapse
It's expected. When we do 'su' on Termux, it's environment is gone and PATH is set to /system/bin etc. So any binaries which Termux downloaded to /data/data/com.termux/files/usr/bin won't work. There are better options, but easiest is to use 'tsu' instead of 'su' on Termux. It will handle things for you to run Termux binaries in superuser mode. Do 'apt install tsu' when connected to internet. Once installed, simply execute 'tsu'. Now you can use Termux rsync binary.
Or use rsync static bianry instead as explained above. Copy rsync to /system/bin/ or /system/xbin/ etc. and set permissions. SELinux may interfere if it's set to "Enforcing". Do 'getenforce' to check and 'setenforce 0' to set it "Permissive".

DrPhant0m said:
That's a lot of help... But I lack the basic understanding and experience to make use of it all. I'll have to Google it a bit and look at some examples. Thanks!
UPDATE: I did a little research, and I succeeded in using "cp" to do a test move in TWRP (I had to use -r and -v), but even using -v didn't create a progress bar or any indication that files were being moved. It just finished and went to the next new line. Is this expected?
Also... my version of TWRP doesn't seem to have rsync available. When I try to use rsync in TWRP, I get
So it seems that TWRP's terminal doesn't have rsync. I'm using TWRP 3.0.2-1
So... I'm currently using the Termux app to do the cp operation. I'd prefer to use rsync, which is supported in Termux, however, unless I do "su" first, it says it doesn't have access to the destination folder. And, when I use "su" I can't use rsync. I get pretty much the same message as when I try to use it in TWRP... something like "rsync not found"
Does this mean that when Termux is using root, it can't use rsync? Does that make sense?
Any help?
Thanks!
Click to expand...
Click to collapse
This reply is probably a bit late for you, but...
If you install tsu (pkg install tsu) in TermUX and use tsu rather than su, it'll work.
Tsu sets up the runtime context for su properly.
Sent from my OnePlus3T using XDA Labs

BillGoss said:
This reply is probably a bit late for you, but...
If you install tsu (pkg install tsu) in TermUX and use tsu rather than su, it'll work.
Tsu sets up the runtime context for su properly.
Sent from my OnePlus3T using XDA Labs
Click to expand...
Click to collapse
Hey, it's never too late to refine your backup strategy. Thanks for letting me know.
I installed tsu in Termux, and when it finished, I tried to use rsync with su, and got the same "rsync: not found" error. Please see the following output, with my entries in Bold[/B].
Code:
$ [B]pkg install tsu[/B]
[COLOR="Gray"][I]~~
~~[LOTS OF LINES DETAILING THE INSTALLATION OF TSU]~~
~~[/I][/COLOR]
Setting up tsu (1.1)...
$ [B]su[/B]
elsa:/data/data/com.termux/files/home # [B]rsync[/B]
sh: rsync: not found
127|elsa:/data/data/com.termux/files/home #
*** Though I did enjoy watching the movie with my son, I did not pick the name Elsa for my device. That's just what LG called the carrier-free V20, Model US996.
Am I doing something wrong? To be clear.. I just did "rsync" without any commands/switches to see if it would produce the help info. I knew it wouldn't actually attempt to copy anything.

DrPhant0m said:
Hey, it's never too late to refine your backup strategy. Thanks for letting me know.
I installed tsu in Termux, and when it finished, I tried to use rsync with su, and got the same "rsync: not found" error. Please see the following output, with my entries in Bold[/B].
*** Though I did enjoy watching the movie with my son, I did not pick the name Elsa for my device. That's just what LG called the carrier-free V20, Model US996.
Am I doing something wrong? To be clear.. I just did "rsync" without any commands/switches to see if it would produce the help info. I knew it wouldn't actually attempt to copy anything.
Click to expand...
Click to collapse
Lol! You missed the key point: use tsu instead of su.
Instead of typing "su", type "tsu".
But don't take it too hard - I did the same thing when I first started.
Sent from my OnePlus3T using XDA Labs

Got it. Worked just fine. Thanks!

DrPhant0m said:
I installed tsu in Termux, and when it finished, I tried to use rsync with su, and got the same "rsync: not found" error. Please see the following output, with my entries in Bold[/B].
Click to expand...
Click to collapse
I mentioned to use 'tsu' instead of 'su' but probably you missed that.
mirfatif said:
When we do 'su' on Termux, it's environment is gone and PATH is set to /system/bin etc. So any binaries which Termux downloaded to /data/data/com.termux/files/usr/bin won't work. There are better options, but easiest is to use 'tsu' instead of 'su' on Termux. It will handle things for you to run Termux binaries in superuser mode. Do 'apt install tsu' when connected to internet. Once installed, simply execute 'tsu'. Now you can use Termux rsync binary.
Click to expand...
Click to collapse
/data/data/com.termux/files/bin/tsu is just a wrapper i.e. a shell script that sets environment variables for Termux and then executes 'su'.

mirfatif said:
I mentioned to use 'tsu' instead of 'su' but probably you missed that.
/data/data/com.termux/files/bin/tsu is just a wrapper i.e. a shell script that sets environment variables for Termux and then executes 'su'.
Click to expand...
Click to collapse
I see it now. I gave a thanks, though admittedly late. Sorry!

Is backup feasible when sd external card has been mounted extending the internal storage (Android 6.0), working as internal storage as well?
Can some expert comment on this, just not to go crazy for nothing. I don't want to upgrade with last rom by manufacturer and lose my data.
I have ADB , fastboot and usb drivers, but trying and use Helium backup I was unable to pair, even though the phone is connected (I can select onscreen for instance PTP or usb storage, tried both, nothing).
Not even sure about nandroid backup also.

HeyRicardo said:
Is backup feasible when sd external card has been mounted extending the internal storage (Android 6.0), working as internal storage as well?
Can some expert comment on this, just not to go crazy for nothing. I don't want to upgrade with last rom by manufacturer and lose my data.
I have ADB , fastboot and usb drivers, but trying and use Helium backup I was unable to pair, even though the phone is connected (I can select onscreen for instance PTP or usb storage, tried both, nothing).
Not even sure about nandroid backup also.
Click to expand...
Click to collapse
Yes it's feasible but depends on what, how and where you want to backup.

mirfatif said:
Yes it's feasible but depends on what, how and where you want to backup.
Click to expand...
Click to collapse
Any solution is fine to me, I just want to be able to restore apps and launcher (Nova launcher prime) with icons arranged as they are, without having to start all over from scratch.
Other data are on the cloud, so if I can possibly backup some folder (from phone or sd card, if the difference matter in my case) good, or I'll take care of it in advance.
Just having the phone upgraded but not reset from the beginning.
If necessary I can try rooting it. Thx for replying.

how to use a twrp data backup for oder rom?

Related

[Tool] SaveMyApp - Preinstall Your Apps

Tired of having to redownload and reinstall all of your apps when you reflash your phone? SaveMyApp can help.
This script will setup your phone so that after your flash to your favorite rom, all* of your apps will be install on the first boot. These apps will show up in the market too!
Also, the script will allow you to backup your /data/data folder to your sdcard and then restore it after your reflash. The /data/data is where Most of your user data is stored. This is not guaranteed to fully restore everything. This also does not backup your Google, Android, or Motorola settings; this is to improve compatibility with roms.
*The /preinstall folder is limited to 120MB, so if you have more then of apps this script will not fully work.
This should work with all phones, however it has only been tested on the Droid 2/X.
If you want to test this script on a different phone, let me know the /preinstall size and if it worked or not.
v0.1.4.2 - 11/17/2010
-Improved backup and restore of data
-Improved script usability
v0.1.4.1 - 11/17/2010
-Improve safety of removing /preinstall/app
v0.1.4 - 11/16/2010
-Added option to clear the /preinstall/app folder
-Added messages to support clear /preinstall/app
v0.1.3 - 11/12/2010
-Added backup of /data/data
-Added messages to support Data Backup
v0.1.2 - 11/11/2010
-Added Backup /data/app-private
-Show /data/app size, prompt user for continue
-Additional messages added to improve user experience
v0.1.1 - 11/10/2010
-First Release
-Backup and Restore /data/app
Installation:
WARNING: This steps must be completed as listed, failure to do so may result in unexpected errors which I am not responsible for.
1. Enable USB debugging and make sure Sdcard is mounted on phone
1. adb push apps.sh /data
2. adb shell
3. cd /data
4. chmod 775 apps.sh
5. ./apps.sh
a. Follow the onscreen directions
6. Reboot and proceed to wipe and reflash
7. On boot, wait between 5 and 10 minutes depending on how many apps you have before logging into your account. (30 apps takes about 4-5 minutes)
8. Login to your account
9. Droid 2/X Bootstrapper -> Bootstrap Recovery
10. Enable USB debugging and make sure Sdcard is mounted on phone
11. adb shell
12. tar -xzpf /sdcard/savemyapp/backup.tgz
FAQS:
Market isn't showing apps!
settings->applications->Manage Applications->All->Market->Force Stop, Clear data
Why is there a MACOSX file when I extract the archive?
Because I am lazy and I zipped it using Mac's built in archiver.
The script isn't working right away!
Redownload the newest script, just to make sure
Disclaimer:
You may repost this, but you must quote it as is.
I will only be responding to the threads I started on the Xda-Developers forums.
First!
I'm just holding a parking spot for this post!
What a great idea...thank you for developing this, im so tired of re downloading my apps back and setting everything up...done it about 10 times in the past month between sbfing and updating the fission rom several updates in a row so thank you...will most definitely be using this when I flash roms in the future. Thanks again
Sent from my DROID2 using XDA App
Excellent program! I'm having trouble getting it to work unfortunately. When apps.sh begins to copy files from /data/apps, I get errors saying "No space left on device" after every single file it tries to copy. This is of course not true since this D2 has over 6 gigs free on the system storage.
I am running this through the window's command prompt, but I don't see much in the code that won't run on windows aside from "du" which isn't even relevant unless my app + app-private folders combined size is over 120 MB (it's not).
I'm also running Epic 2.5 if that has anything to with this.
Any ideas? Am I just doing this terribly wrong?
Thanks!
tildaSparky said:
Excellent program! I'm having trouble getting it to work unfortunately. When apps.sh begins to copy files from /data/apps, I get an error saying "No space left on device." This is of course not true since this D2 has over 6 gigs free on the system storage.
I am running this through the window's command prompt, but I don't see much in the code aside from "du" which can't run with windows.
Any ideas? Am I just doing this terribly wrong?
Thanks!
Click to expand...
Click to collapse
If you read the first post it states the /preinstall folder can only hold only 120mb so it you have more than that to backup it won't fully work..I'm guessing that's were the apps are being saved...
Sent from my DROID2 using XDA App
turkeybuzzard said:
If you read the first post it states the /preinstall folder can only hold only 120mb so it you have more than that to backup it won't fully work..I'm guessing that's were the apps are being saved...
Sent from my DROID2 using XDA App
Click to expand...
Click to collapse
Apps are normally saved in /data/app this script copies those apks to /preinstall so that after a wipe they will automatically be installed on the first boot. Yes /preinstall is limited to about 120MB.
tildaSparky said:
Excellent program! I'm having trouble getting it to work unfortunately. When apps.sh begins to copy files from /data/apps, I get an error saying "No space left on device." This is of course not true since this D2 has over 6 gigs free on the system storage.
I am running this through the window's command prompt, but I don't see much in the code aside from "du" which can't run with windows.
Any ideas? Am I just doing this terribly wrong?
Thanks!
Click to expand...
Click to collapse
Do you get the "No space left on device" message instantly or after some apks were copied to the /preinstall folder?
Here's what I get
Working…
cp: /preinstall/app/com.google.android.apps.maps-1.apk: No space left on device
cp: /preinstall/app/com.google.android.apps.translate-2.apk: No space left on device
cp: /preinstall/app/com.google.android.gm-1.apk: No space left on device
cp: /preinstall/app/com.google.zxing.client.android-2.apk: No space left on device
etc.
=(
tildaSparky said:
Here's what I get
Working…
cp: /preinstall/app/com.google.android.apps.maps-1.apk: No space left on device
cp: /preinstall/app/com.google.android.apps.translate-2.apk: No space left on device
cp: /preinstall/app/com.google.android.gm-1.apk: No space left on device
cp: /preinstall/app/com.google.zxing.client.android-2.apk: No space left on device
etc.
=(
Click to expand...
Click to collapse
How big is your /data/app folder?
OK! I sort of have it fixed. In that I'm not getting my original error.
What I did (which in retrospect was not such a hot idea) was delete the /preinstall/ folder and then created a new one with the subfolders /app/ and /md5/. The logic behind was that I saw the script had nothing in it to clean out the original preinstall folder, and I noticed that it had silly things like NFS in it. As I said, in retrospect I should have just deleted specific items from the folder, but that's what I get for acting without thinking too much.
How bad do you think it is that I remade the preinstall folder from scratch?
Now my preinstall folder is properly populated (I think). But the data won't back up for some reason. I think it might have something to do with the if statements being broken. I'm gonna go ahead and modify your script to bypass the if/else statements and see what happens.
SaveMyApp v0.1.2
By csscmaster3
Your app folder takes up
du: not found
If your app folder is more then 114MB I don't recommend continuing
do you want you to continue? (y/n)y
y
[[: not found
Working…
ignore No such file or directory error if you get it
tee: not found
SaveMyApp has completed your apps
Do you want to backup your data? (y/n)y
y
[[: not found
SaveMyApp has completed.
As an aside my app folder is 28 MB and my app-private folder has only the apkinstaller.
tildaSparky said:
OK! I sort of have it fixed. In that I'm not getting my original error.
What I did (which in retrospect was not such a hot idea) was delete the /preinstall/ folder and then created a new one with the subfolders /app/ and /md5/. The logic behind was that I saw the script had nothing in it to clean out the original preinstall folder, and I noticed that it had silly things like NFS in it. As I said, in retrospect I should have just deleted specific items from the folder, but that's what I get for acting without thinking too much.
How bad do you think it is that I remade the preinstall folder from scratch?
Now my preinstall folder is properly populated (I think). But the data won't back up for some reason. I think it might have something to do with the if statements being broken. I'm gonna go ahead and modify your script to bypass the if/else statements and see what happens.
SaveMyApp v0.1.2
By csscmaster3
Your app folder takes up
du: not found
If your app folder is more then 114MB I don't recommend continuing
do you want you to continue? (y/n)y
y
[[: not found
Working…
ignore No such file or directory error if you get it
tee: not found
SaveMyApp has completed your apps
Do you want to backup your data? (y/n)y
y
[[: not found
SaveMyApp has completed.
As an aside my app folder is 28 MB and my app-private folder has only the apkinstaller.
Click to expand...
Click to collapse
The NFS removal is a good call, I will append the script to check the /preinstall folder and prompt to remove the files there
The reason you are having trouble with this script looks it be like because you are not running it on the phone itself...meaning to say you are not running it via a terminal emulator on the phone nor are you running it via adb shell. The backup uses tar, which isn't on windows by default.
Actually I'm running everything through the adb shell. It's puzzling to me too. My terminal emulator for some reason doesn't have root access. At this point I think I'm just going to SBF anyway.
At any rate, I just decided to pull /data/data/ from my phone onto my HD and I will replace it after I reflash and install my programs, but before I log into my google account. Do you see any reason for this not to work?
tildaSparky said:
Actually I'm running everything through the adb shell. It's puzzling to me too. My terminal emulator for some reason doesn't have root access. At this point I think I'm just going to SBF anyway.
At any rate, I just decided to pull /data/data/ from my phone onto my HD and I will replace it after I reflash and install my programs, but before I log into my google account. Do you see any reason for this not to work?
Click to expand...
Click to collapse
Hmmm, you might have to check your superuser app to see if you accidently are denying su access. In adb shell do you have a $ or a #?
Backing up the /data/data folder to your HD then restoring might not work because I am not sure if it will retain the owner, permissions, etc.
I had a # in my shell. There was something slightly wonky about my root I think. At any rate my backup method didn't work so well (as you predicted) - it caused timeriffic to force close when I tried to load in my old settings via /data/data/.
I will try using this again once I've got my shiny new Fission 2.1 set up as I want.
Thanks for your attentiveness!
I'm guessing this script should be run AFTER all of the applications have been installed. Is this correct?
wsfanatic said:
I'm guessing this script should be run AFTER all of the applications have been installed. Is this correct?
Click to expand...
Click to collapse
That is correct
Sent from my DROID2 using XDA App
Ooooo this is getting popularrrr
Is this D2 specific, or would it work on any phone?
theimpaler747 said:
Is this D2 specific, or would it work on any phone?
Click to expand...
Click to collapse
It works with the D2 and should work with the DX, anything else is use at your own risk, if it does work let me know though
csscmaster3 said:
It works with the D2 and should work with the DX, anything else is use at your own risk, if it does work let me know though
Click to expand...
Click to collapse
Might risk it and try it on my hero Regardless, nice work
theimpaler747 said:
Might risk it and try it on my hero Regardless, nice work
Click to expand...
Click to collapse
The only problem I could forsee would be the /preinstall folder being different or something, if you do end up trying the script could you let me know the size of the /preinstall folder?

[Q] Inevitable Newbie questions

Bought a rooted Captivate on ATT with ICS 4.0.4 and cyanogen 9. Tried to unlock it but could not get nv_data.bin to copy to my sdcard. Ended up just calling ATT and they gave me the code.
Forgive me if these answers are here. I looked, I couldn't find them.
Why doesn't cat /efs/nv_data.bin >> /sdcard/nv_data.bin result in the file being copied to the sdcard next to the sim card? Does that sdcard have a different name? I put an apk file on there via my computer (LOST.DIR was there from the phone, btw) but the phone said nothing was on the sdcard, which means I'm looking at the wrong sdcard somehow?
Why does my SGH-i897 have an i9000UGKG3 baseband and does that make the phone a GT-i9000 or is it still an i897?
Why does Google Play not allow registering a second device so that the app store can be accessed? I got the apk for the store downloaded and installed, but it just launches and then immediately closes.
I found KIESAIR-1.apk, downloaded it but that halts with a message "Application not installed." No idea why. Tried two versions of Kies Air. Both installations halted. I did check allow unknown sources. I want Kies Air because I cannot get USB to work with the phone on three different Windows laptops and that's a whole other kettle of fish.
Much appreciate any info you can share.
-Bob
To answer your first question, i think the command would be going to /mnt/sdcard instead of just /sdcard.
I loathe kies air. You can use "Air Droid", it should be on the market. There are other similar applications where you can transfer files via Wi-Fi. Hopefully someone else here will help you with accessing the market.
The baseband is the modem(or radio, not sure what term exactly) your phone is running, which is what the phone uses to get a signal and access the data network People report higher data speeds, better signal, and better GPS reception with different modems. It's still a Samsung Captivate. I'm using an I9000 modem as well.
That's all I can answer for you, I'm sort of a newbie too. Lots of reading and googling helps.
the micro sd card is mounted as
/sdcard/external_sd
the path /sdcard is the internal user storage.
Sent from my SAMSUNG-SGH-I897 using xda app-developers app
Thank you very much. So that I can have better luck with Google searches in the future, can you tell me how you came to know this? All I came up with in my searches was /mnt/sdcard but that turned out to be the system card and I'm lucky I didn't screw up anything.
Found the various wikis on XDA for Captivate and now reading through them.
laughingT said:
the micro sd card is mounted as
/sdcard/external_sd
the path /sdcard is the internal user storage.
Sent from my SAMSUNG-SGH-I897 using xda app-developers app
Click to expand...
Click to collapse
I had tried that, but forgot to mention it. As somebody else pointed out, that turned out to be the system card.
bobcov said:
Why does Google Play not allow registering a second device so that the app store can be accessed? I got the apk for the store downloaded and installed, but it just launches and then immediately closes.
-Bob
Click to expand...
Click to collapse
Are you sure gapps was ever flashed once CM9 was installed? You might flash it again anyway and see if that helps. I've never known Play to limit registrations.
It has to be part of the firmware? Is that what you mean by it has to be flashed? Where can I read about that? BTW, I now have access to the phone via Android Sync Manager over wifi. Trying to find a way to put contacts into it without using Gmail. Seems I can't see the entire file system. The contacts are supposed to be in a file in this path data/data/com.android.providers.contacts/databases/contacts.db, but that path doesn't show up. How come? I'll be looking back at this post someday chuckling, but for now, I'm mystified.
bobcov said:
It has to be part of the firmware? Is that what you mean by it has to be flashed? Where can I read about that? BTW, I now have access to the phone via Android Sync Manager over wifi. Trying to find a way to put contacts into it without using Gmail. Seems I can't see the entire file system. The contacts are supposed to be in a file in this path data/data/com.android.providers.contacts/databases/contacts.db, but that path doesn't show up. How come? I'll be looking back at this post someday chuckling, but for now, I'm mystified.
Click to expand...
Click to collapse
When you install cyanogenmod Google apps (gapps) aren't included. If the previous owner didn't add them then none of your Google apps nor your sign in will be present. Even if it is already installed a reinstall may help.
Download this: http://goo.im/gapps/gapps-ics-20120429-signed.zip
Reboot to recovery and install zip from sdcard. You'll have to find and choose the file you just downloaded. Reboot and see if things aren't square.
You can also do a nandroid backup from the recovery so you can get back to where you are now if things go awry. Side note, if you want to install the latest cm9 nightly the method is the same.
You can find clearer instructions via the cyanogenmod site should you feel uneasy about proceeding. I'm away from the PC and typing from my phone or I'd try to be more thorough. Good luck!
---------- Post added at 08:28 PM ---------- Previous post was at 08:19 PM ----------
bobcov said:
It has to be part of the firmware? Is that what you mean by it has to be flashed? Where can I read about that? BTW, I now have access to the phone via Android Sync Manager over wifi. Trying to find a way to put contacts into it without using Gmail. Seems I can't see the entire file system. The contacts are supposed to be in a file in this path data/data/com.android.providers.contacts/databases/contacts.db, but that path doesn't show up. How come? I'll be looking back at this post someday chuckling, but for now, I'm mystified.
Click to expand...
Click to collapse
I just checked and found my contacts where you mentioned. You probably just need to copy the file using a file manager and move it to an accessible location you can see from the PC. I like root explorer. ES file manager is good, too, and free.
Since you may not have gapps I'd try that first and it may create the contacts db.
Hi,before I can try what you suggested, I need to straighten out what's up with my file system. I still cannot see my external sd card in file operations, even though the phone shows it is present, lets me mount and unmount it. If I copy something to it from the laptop using a card reader, nothing shows up when it is mounted in the phone. The other mystery is that with ES file explorer, I still do not see the contacts.db file path, so I'm doing something wrong. Once I can see that path and see the external sd, I'll follow your instructions.
-B
Make sure you have root function enabled in es file explorer. It's in settings.
With the external sd , on cm9 you'll find it at /emmc. (or /mt/emmc)
But read up on flashing.... You won't regret it.
Sent from phone with app
i believe the external sd card is called emmc on the ics roms
try opening a terminal emulator, then type:
df
the ouput from df will give you total space and free space for mounted paths, including your sdcard, if it is mounted.
if you want to see rootsystem files, run su before df.
there is a free terminal emulator on google play, aka market, if you need it.
Sent from my SAMSUNG-SGH-I897 using xda app-developers app
bobcov said:
Hi,before I can try what you suggested, I need to straighten out what's up with my file system. I still cannot see my external sd card in file operations, even though the phone shows it is present, lets me mount and unmount it. If I copy something to it from the laptop using a card reader, nothing shows up when it is mounted in the phone. The other mystery is that with ES file explorer, I still do not see the contacts.db file path, so I'm doing something wrong. Once I can see that path and see the external sd, I'll follow your instructions.
-B
Click to expand...
Click to collapse
At this point, how do you feel about starting over? Some people aren't comfortable with a full factory reset and/or starting over with stock gingerbread, but I'd be leaning toward that at this point. I'm not completely sure it's necessary but I've wiped clean for less.
Well, after many days, I am now finally importing 750 contacts without exposing any of them to a 3rd party server such as Google, etc.
1. There's a link here somewhere for version 1.3.450.0 "Samsung USB Driver for Mobile Phones. The filename was SAMSUNG_USB_Driver_for_Mobile_Phones_x86.exe
2. Forget about Kies. Somebody said it won't work unless it sees Touch Wiz. I don't know if it would work under any circumstances.
3. For my 750 contacts in blackberry, I made an .ipd backup of the blackberry using the RIM software, then used ABC Amber Blackberry Converter which can extract data from IPD backups and exported my contacts as CSV.
4. I used Windows Address Book to read the CSV file created by Amber and saved the file with .WAB as a Windows Address Book file.
5. I used the inexplicably free and astoundingly well-executed Wondershare MobileGo for Android program to link to my phone. On one computer it immediately identified the model and showed all contents. On another computer, it could not see the phone, and went to the web without prompting, downloaded a driver, installed it and loaded the phone into the program. Amazing. All I did was click on contacts on the left and then the small down arrow under the word "Import" on the Import icon. It took me about an hour to realize this was how to get the program to import different formats other than vcard. It somehow immediately found the .WAB file, and imported the 750 contacts where are now on the phone.
6. For the purposes of entertainment for those who know better and education for those who don't, here were some of my downfalls: All the apps may respond to that little funny symbol on the left, below the keyboard adjacent to "Samsung." I didn't know for the longest time that was a critical menu key. Also mirthful, I didn't know that you can just draw downward from the top of the screen and get a kind of status page where you will see "USB connected" which you must press if you want to copy stuff to the phone. I will now read the phone's manual.
It seems that the external card under Cyanogenmod 9 is /mnt/emmc/ instead of where programs expected it to be. I got a program called Directory Bind and tried to make it so that /mnt/emmc/ would automatically be seen as /mnt/sdcard/external_sd but it said that that wasn't a valid target. Any ideas there? Meantime I have done it from terminal but I don't think that will stick beyond a reboot.
Damn you learn quick. When I first discovered the menu key it was like discovering a while new world.

[GUIDE] Internal Memory Data / Deleted Files Recovery

This is the same tutorial written by Wartickler at this link. Thanks for his efforts, his work is appreciated.
Here we bring minor changes to the tutorial for those of you who are facing problems accomplishing the procedures.
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 still there is a hope.....
The Process
My phone is the Samsung Galaxy s4 (GT-I9500) 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,
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 (at the package selection screen search for pv then util-linux and click on Default to change it to Install). Make sure to open Cygwin once to make sure that the /bin folder is created. Also, I made a folder at [c:\cygwin\samsung] to put the exported .RAW file,
Netcat (download the ZIP file and extract nc.exe to [c:\cygwin\bin]),
ADB - You can use minimal adb and fastboot which is 2MB only. Attached, find the link at the bottom of this post. (make sure adb.exe is in your path. Path is in System Properties -> Advances -> Environment Variables -> System variables -> Path and add to the end: ";C:\Program Files\Android\sdk\platform-tools" or where ever you placed your adb.exe),
USB Debugging enabled on your device,
VHD tool from the mighty M$. Put the VhdTool.exe file in [c:\cygwin\samsung],
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.
[*]*****For identifying which block/partition you want to recover, install DiskInfo from Playstore. Open the app and click on Data (USERDATA) to see the partition name for yours. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p21
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]):
*Remember to enter codes line-by-line. After you enter su, you have to grant permission on your mobile phone at the same time
Code:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p21
Open another Cygwin terminal and enter:
Code:
adb forward tcp:5555 tcp:5555
cd /samsung
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p21.raw
[*]Depending on the size of partition it may take a while to backup.
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\samsung], and type:
Code:
VhdTool.exe /convert mmcblk0p21.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\samsung\mmcblk0p21.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:
Good Luck :good:
help
M S T F said:
This is the same tutorial written by Wartickler at this link. Thanks for his efforts, his work is appreciated.
Here we bring minor changes to the tutorial for those of you who are facing problems accomplishing the procedures.
Good Luck :good:
Click to expand...
Click to collapse
You should add that the x86 version of Cygwin is needed, not the x64.
Do you also know that as of Android 4.3 this method doesn't work anymore?
yes
Lennyz1988 said:
Do you also know that as of Android 4.3 this method doesn't work anymore?
Click to expand...
Click to collapse
it works with 4.4.x and 5.1.1, it probably also works with 4.3. it's just an adb command after all.
Filoppi said:
it works with 4.4.x and 5.1.1, it probably also works with 4.3. it's just an adb command after all.
Click to expand...
Click to collapse
No its not that. As of Android 4.3 Google enabled Trim on our decives. That means when you delete a file its really gone. Not even a professional company can get it back.
I have tried the above methode and I could not get any data back. Thats when I started reading about Google enabling Trim and found out its impossible to get it back.
Did you try it on Android 4.3+?
try
Lennyz1988 said:
Do you also know that as of Android 4.3 this method doesn't work anymore?
Click to expand...
Click to collapse
Lennyz1988 said:
No its not that. As of Android 4.3 Google enabled Trim on our devices. That means when you delete a file its really gone. Not even a professional company can get it back.
I have tried the above method and I could not get any data back. Thats when I started reading about Google enabling Trim and found out its impossible to get it back.
Did you try it on Android 4.3+?
Click to expand...
Click to collapse
I have tried on my previous Samsung galaxy s3 (i9300) and my one plus one, both 64gb, i got at least 20% of the pictures back (.png, .jpg, ...), possibly even 50% since i had no idea how many i had on the device, some zip, most of .pdf and .doc and some other random stuff.
In both cases i did not manually delete the files from the phone, instead, i screwed up the partitions by deleting some system file, so after restarting, the SDcard/used data partition was empty.
i noticed though that even if my phone only had 500mb of free space available, the .raw partitions i extracted with this method were mostly empty, they only had about 10% of the data, so i guess some happened when android restarted, maybe yeah, some kind of trimming.
i think its worth trying anyway. just remember to not open any program or copy any file in the memory, as it would lower the chances to get anything back.
Filoppi said:
I have tried on my previous Samsung galaxy s3 (i9300) and my one plus one, both 64gb, i got at least 20% of the pictures back (.png, .jpg, ...), possibly even 50% since i had no idea how many i had on the device, some zip, most of .pdf and .doc and some other random stuff.
In both cases i did not manually delete the files from the phone, instead, i screwed up the partitions by deleting some system file, so after restarting, the SDcard/used data partition was empty.
i noticed though that even if my phone only had 500mb of free space available, the .raw partitions i extracted with this method were mostly empty, they only had about 10% of the data, so i guess some happened when android restarted, maybe yeah, some kind of trimming.
i think its worth trying anyway. just remember to not open any program or copy any file in the memory, as it would lower the chances to get anything back.
Click to expand...
Click to collapse
Yes but that's something different I think. Then you never deleted the files, they were there but not accessible.
If you look for example in the last 10 pages of the main thread, then no one is able to recover anything. Because it's simple not possible anymore. That's just how Trim works.
Lennyz1988 said:
Yes but that's something different I think. Then you never deleted the files, they were there but not accessible.
If you look for example in the last 10 pages of the main thread, then no one is able to recover anything. Because it's simple not possible anymore. That's just how Trim works.
Click to expand...
Click to collapse
I'm sorry for your loss.
Filoppi said:
I'm sorry for your loss.
Click to expand...
Click to collapse
What kind of response is that?
gonna try.
for those of u who want to know the blocks and partitions to recover the user data..
ls -l /dev/block/platform/*/by-name
after the adb shell will list them
127.0.0.1 5555 | pv -i 0.5 > mmcblk0p16.raw 0 B 0:00:02 [ 0 B/s]
i stuck at step 7 which is
0 B/s transfer rate
GoGopowerRanger said:
i stuck at step 7 which is
0 B/s transfer rate
Click to expand...
Click to collapse
That su is the most important part of command, if you miss it adb will not be able to transfer any data
M S T F said:
That su is the most important part of command, if you miss it adb will not be able to transfer any data
Click to expand...
Click to collapse
You should be honest with people. You should put in the op that it will only work on Android versions below 4.3. People are just getting false hope and wasting their time.
This method does NOT work anymore.
Lennyz1988 said:
You should be honest with people. You should put in the op that it will only work on Android versions below 4.3. People are just getting false hope and wasting their time.
This method does NOT work anymore.
Click to expand...
Click to collapse
This is not my method nor I have, my self said that 100% you will get what you have deleted. I have only brought minor changes to the tutorial for the sake of successful transfer of data to the pc.
Now if you feel responsible for the feeling of people, definitely I will appreciate if you find another way.
M S T F said:
This is not my method nor I have, my self said that 100% you will get what you have deleted. I have only brought minor changes to the tutorial for the sake of successful transfer of data to the pc.
Now if you feel responsible for the feeling of people, definitely I will appreciate if you find another way.
Click to expand...
Click to collapse
That's the thing. You just copy paste a tutorial that does not work. Why would you do that? I can imagine that you did not know that it would not work anymore. But now you do know. What do you hope to achieve? Raising your thanks meter? You give people false hope and you waste their time.
And about me finding another way....There is not even a professional company that can do it. It's impossible at the moment.
Lennyz1988 said:
That's the thing. You just copy paste a tutorial that does not work. Why would you do that? I can imagine that you did not know that it would not work anymore. But now you do know. What do you hope to achieve? Raising your thanks meter? You give people false hope and you waste their time.
And about me finding another way....There is not even a professional company that can do it. It's impossible at the moment.
Click to expand...
Click to collapse
I don't need thanks... why I should do.... it doesnt give me anything... I have got my own forum with its nice members.... if someone is in need of thanks, thats is you which is trying to show himself as a defender of others feeling, time, blah blah.......
I have recovered my file on a 4.4.2 android after a system crash which I had to reset the phone. if someone is in desperate need of something s/he will try anything and as far as I know trying this one doesn't harm anyone.
for you I have a recommendation, go and drink something cold and calm down!!!
Errr...
Awesome....the raw extraction worked on my S6 running Android 5.0.2. This time I tried it on a Mac and used Homebrew to install PV. Is there a way to get the entire image, even with the unused space?
Great
Thank you!
Worked on my sm-g900f
If you get nc/pv command not found , try this:
When you open cygwin terminal, start with this line: export PATH="/cygdrive/c/cygwin/bin";$PATH
The terminal should now know the location of them.
Same if you get that "adb: command not found" just type: export PATH=/cygdrive/c/XXXXX";$PATH
Just replace that XXXXX= to your location of adb.exe.
Hope it helps someone out of this ****

Backing Up to External SD Using TWRP Command Line and No Display

I've spent the last couple days searching around to fix this problem, not only on XDA and Google, but in TWRP's Issues and code on GitHub; all to no avail. So here it is:
I have a device with a broken display. The only way I can initiate commands on it are with the power, volume, and home buttons, and with adb. I've installed TWRP on it, and I'm able to boot into it. I'm trying to back up everything on the device I can to a 32GB external SD card in the device's SD card slot. But when I keep getting the following result:
Code:
~ # twrp backup SDBOM
Setting backup options:
System
Data
Boot
Compression is on
Digest Generation is off
Updating partition details...
...done
* Total number of partitions to back up: 3
* Total size of all data: 7976MB
* Available space: 496MB
Not enough free space on storage.
Backup Failed
Done processing script file
The External SD Card has more than enough space for the backup (several times over, in fact), so clearly TWRP is attempting to save the backup to the device's internal storage. It seems, from testing I've done on an identical device with a working display, that twrp backup in the command line saves to the Storage last selected in the graphical version, but since my device's display is broken I can't select the External SD Card as the storage for the backup.
Since I have no display, I also can't do adb backup --twrp, since that requires confirmation on the screen.
Is there any way to select the storage for twrp backup fully through the terminal? For example, is there an environment variable I can set, or something I can pass twrp backup?
I figure this is an easy one to answer, and that it's something really, obviously, simple (so much so that I'll have to hang my head and never show my face here again!). But for the life of me, I can't find it.
Same thing here. In my case I have a working display but my kernel does not allow any touchscreen operations when in recovery so I can see TWRP but not input anything. So the command line is my only way to use TWRP but like you I cannot switch to creating backups to my external SD card.
It seems funny there is no solution to this since having touch screen problems with TWRP seems to be a common issue so how do all those folks with no touch recoveries do their backups?
check to which folder mount yours external SD
and set var "tw_storage_path" with "twrp set"
example "twrp set tw_storage_path /external_sd"
you can find this var in android_bootable_recovery/openrecoveryscript.cpp
also
you can change backup folder
example "twrp set tw_backups_folder /external_sd/all"
can find it in android_bootable_recovery/variables.h
OrBitRo said:
check to which folder mount yours external SD
and set var "tw_storage_path" with "twrp set"
example "twrp set tw_storage_path /external_sd"
you can find this var in android_bootable_recovery/openrecoveryscript.cpp
also
you can change backup folder
example "twrp set tw_backups_folder /external_sd/all"
can find it in android_bootable_recovery/variables.h
Click to expand...
Click to collapse
Hello and thank you very much for helping on this issue.
I gave up on this long ago but it is still of great interest to me since I am still using the same phone and TWRP backup would be welcome. But since so much time has passed since I unpacked the recovery, I am a bit rusty at it. I am an old programmer but my android knowledge is limited, still I did succeed to make the sdcard visible to the recovery (cant remember how but I think I changed its block name in recovery.fstab then for some other reason also had to un-repack) so I can handle such things if I am guided a bit.
So your help is very welcome and also reignited my interest to solve this issue. Problem is I cannot find the "android_bootable_recovery/openrecoveryscript.cpp" script in the unpacked recovery or the phone's file system. I am sure I am missing something silly but googling around did not help me either.
Could you possibly guide me into finding those scripts so I can edit the aforementioned variables?
Thank you very much for your attention and help.
Chris.
cfrantzol said:
(cant remember how but I think I changed its block name in recovery.fstab then for some other reason also had to un-repack) so I can handle such things if I am guided a bit.
Click to expand...
Click to collapse
Nice hack too!
cfrantzol said:
Problem is I cannot find the "android_bootable_recovery/openrecoveryscript.cpp" script in the unpacked recovery or the phone's file system. I am sure I am missing something silly but googling around did not help me either.
Could you possibly guide me into finding those scripts so I can edit the aforementioned variables?
Thank you very much for your attention and help.
Chris.
Click to expand...
Click to collapse
I find it (i have same problem like yours after 6 hours mess in adb and googling ) in sources of twrp on github github.com/omnirom/android_bootable_recovery
And also about factory reset (to whom it may concern) github.com/omnirom/android_bootable_recovery/issues/146
OrBitRo said:
Nice hack too!
I find it (i have same problem like yours after 6 hours mess in adb and googling ) in sources of twrp on github github.com/omnirom/android_bootable_recovery
And also about factory reset (to whom it may concern) github.com/omnirom/android_bootable_recovery/issues/146
Click to expand...
Click to collapse
Hi again.
Okay now I understand, I will download from there and check what I can come up with. I already feel that this will involve some compiling and I wonder how that is going to affect my custom TWRP (which I found at twrp builder). I will step into it and see.
Thanks a lot for your prompt help, I really appreciate.
cfrantzol said:
I already feel that this will involve some compiling and
Click to expand...
Click to collapse
Sorry if i misunderstand you but why compiling? You dont need it. You can change this vars from adb terminal. Boot device into TWRP connect USB to PC run adb shell and you can change vars in shell via commands like this: 'twrp set tw_storage_path /external_sd' and so on.
OrBitRo said:
Sorry if i misunderstand you but why compiling? You dont need it. You can change this vars from adb terminal. Boot device into TWRP connect USB to PC run adb shell and you can change vars in shell via commands like this: 'twrp set tw_storage_path /external_sd' and so on.
Click to expand...
Click to collapse
Oops, I thought I had to change the variable in the source files and then compile the recovery from scratch. This is now great news I will check it tonight.
Thank you again!
EDIT: For anyone who has the same problem I confirm that I checked it and the method above works fine! Kudos to you OrBitRo!

Question Android's lack of an easy-to-use local computer backup.

Deciding among:
(1) Samsung Galaxy S Flagship
(2) Pixel
(3) iPhone
Samsung -- offers Smart Switch to create good-enough system backups. Not to mention Samsung DeX and SideSync. Killer and easy-to-use. Apps that don't want you copying their "private data" will obviously have their "private data" get left behind. No big deal.
iPhone -- their local backup feature is sweet and reliable. Plus there are 3rd Party Apps that let you browse thru your backups if that's your thing. It seems to grab almost everything except for things like Signal's messaging data and Banking Apps' data, which is fine with me. Apps that don't want you copying their "private data" will obviously have their "private data" get left behind. No big deal.
Pixel -- this is why I'm here and what I'm bugging out about. I love stock Android. But, there is no native backup-to-computer function. I'm fine with having to use some "advanced tools" like adb. I'm familiar with CLIs. But, I don't have much experience with flashing ROMs and stuff. I basically only have 1 phone right now. So, I can't experiment on it.
Based on some reading:
Here's what I want to accomplish with a Pixel phone WITHOUT ROOTING IT:
(1) Buy a Pixel 4a 5G and set it up as desired.
(2) Use TWRP to backup the whole thing to my PC via adb/USB.
(3) Then, let's say I accidentally break my Pixel 4a 5G 128GB into pieces. But, I go to Best Buy and get/buy a new one as a replacement.
(4) Now, on the replacement unit: I put in the right SIM card, unlock the bootloader, use adb and fastboot to load up TWRP, and then restore the aforementioned backup from the computer.
(5) Now, when I reboot, everything will be essentially back to what it was like in the original phone?
Is this even possible? Do I sound ignorant here? Be honest. Hit me with the truth.
To create a NAND backup phone must be rooted.
jwoegerbauer said:
To create a NAND backup phone must be rooted.
Click to expand...
Click to collapse
And, this TWRP thing cannot backup without root?
Sorry, I'm a bit new to these terms.
Maybe I shouldn't even be using them.
So, adb is deprecated and there is no safe non-root way to create a backup except to get a Samsung phone.
As soon as the SU-binary got copied to Android Android is rooted. You don't need to install TWRP or other things to perform a full NAND backup. This can be done by means of ADB utilizing the dd command once SU-binary is present in Android.
Wouldn't a dd backup be unnecessarily large?
I'd prefer something that replicates the entire partition table and directory structure over to the new or same phone.
Does rooting always reset your phone as you have to unlock the bootloader?
nixnixnixnix4 said:
Wouldn't a dd backup be unnecessarily large?
I'd prefer something that replicates the entire partition table and directory structure over to the new or same phone.
Click to expand...
Click to collapse
The dd command creates a bitwise copy of the partition selected, thus it isn't "unnecessarily large".
Pseudo code:
copy SU-binary onto Android
make SU-binary executable
using SU-binary mount whole Android as RW
get list of all Android partitions - i.e. corresponding block devices
for each block device found copy its content by means of adb exec-out <- dd to pc
jwoegerbauer said:
The dd command creates a bitwise copy of the partition selected, thus it isn't "unnecessarily large".
Pseudo code:
copy SU-binary onto Android
make SU-binary executable
using SU-binary mount whole Android as RW
get list of all Android partitions - i.e. corresponding block devices
for each block device found copy its content by means of adb exec-out <- dd to pc
Click to expand...
Click to collapse
Don't I have to unlock the bootloader, which wipes the phone, in order to get root?
I thought there was no way to root a Pixel without unlocking the bootloader?
nixnixnixnix4 said:
Don't I have to unlock the bootloader, which wipes the phone, in order to get root?
I thought there was no way to root a Pixel without unlocking the bootloader?
Click to expand...
Click to collapse
As I can see you didn't get it - for whatever reason. I'm no longer participating this thread ...
jwoegerbauer said:
copy SU-binary onto Android
Click to expand...
Click to collapse
Where and how do you find it for a Pixel?

Categories

Resources