See the top rated post in this thread. Click here

Results 1 to 5 of 5
  1. #1

    Question Backing up my phone using adb isn't working. What am I doing wrong?

    Hi,

    Thanks in advance for reading this.

    Details:


    Phone: Google Nexus 4
    OS: Android 4.4.2
    Android SDK OS: Windows 7x64 SP1
    adb version: 1.0.31


    Eventually I hope to unlock the bootloader and then root my phone, but right now I'm struggling with making a backup and until I get that accomplished I don't feel comfortable going any further. I hope that someone here more knowledgeable can point out what I'm doing wrong.

    Long story short, I fully charged the Nexus 4, updated the existing Android SDK so I'm using the latest version of adb and installed the Google USB drivers by choosing to install "legacy" devices and selecting all three drivers (one at a time). I then removed the fake legacy devices and chose to leave the drivers installed.

    I then connected the Nexus 4 in USB debugging mode and it was detected via
    Code:
    adb devices
    . I read here about using
    Code:
    adb pull /sdcard/ /sdcard/
    and translated that to:

    Code:
    adb pull /sdcard/ .\sdcard
    since I am on a Windows box. That worked fine until a subfolder within /sdcard/Android for the Amazon Kindle app was encountered. The copy attempt was aborted due to a filename that I'm guessing the NTFS filesystem didn't care for.

    I figured I would just move past that and come back to it later; maybe use ES File Explorer to create a zip file or copy/paste specific folders via Windows Explorer interface.

    I then moved on to running adb backup and ran:

    Code:
    adb backup -apk -shared -all -f .\nexus4-backup-010114.ab
    After a long while the command appeared to complete and control was returned to the command prompt. The resulting file was about 1 GB in size and no errors were shown on the phone or on the command prompt by adb.

    Not one to trust just one run, I tried it a second time and the process hung. I cancelled the adb call and ran
    Code:
    adb reboot
    to reboot the phone. I tried again and the process hung yet again.

    I've tried all of the following and the process seem to hang (waited several hours one time):

    *
    Code:
    adb backup -apk -shared -all -f .\nexus4-backup-010114.ab
    *
    Code:
    adb backup -apk -shared -all -nosystem -f .\nexus4-backup-010114.ab
    *
    Code:
    adb backup -apk -noshared -all -nosystem -f .\nexus4-backup-010114.ab
    and based on the suggestion here I tried with and without an encryption password. The first attempt was without a password and later attempts was with providing a password at the time of the backup (when prompted on the phone).

    Before posting this, I tried setting a password within the Developer options on the phone and had the same luck with running:

    Code:
    adb backup -apk -shared -all -nosystem -f .\nexus4-backup-010214.ab
    By this point I'm ready to throw the phone against the wall (even if it doesn't deserve it). Any help would be appreciated.

    Thanks!

  2. #2
    Member
    Join Date
    Jan 2014
    Posts
    5

    Original Poster
    I ended up giving up on this as I've spent three days and didn't want to wait any longer. I backed up the contents of /sdcard/ into a zip file (using ES File Explorer) and will restore contents manually as necessary.



  3. #3
    Member
    Join Date
    Jan 2014
    Posts
    5

    Original Poster
    I'm going to use this thread to note some results of my experimenting in the hopes that it will be useful to someone searching this forum (or via Google) in the future. If nothing else it will help me organize my thoughts and maybe not screw my phone up.

    ---

    I restored contents from the zip file and a surprising amount of content was restored, but unfortunately not stuff like bookmarks and other personal settings. However after I unlocked the bootloader and rooted the phone I was able to make a backup by running:

    Code:
    adb backup -apk -shared -all -f nexus4-backup-010414.ab
    I'm not sure if it was just unlocking the bootloader that allowed it to work or that + rooting the phone or maybe something else entirely. Whatever the case that command completed successfully. I'm going to run several more backups with differing options and then will flash the phone back to stock and try restoring from that.

    Just before that I'll try making a backup via TWRP (haven't really looked into the details yet) and also follow this guide to try and make a backup of the entire phone (OS, Recovery, etc).

    I'm hoping I don't have to spend all of my time restoring the phone from scratch if this doesn't work, but it's worth trying this to find a reliable solution.

    ---

    I picked another tool from the tool chest and tried using the Nexus Root Toolkit (NRT) v1.8.0 since others have recommended it. I know it's not good to rely on toolkits, but I wanted to see what it was capable of. It rebooted the phone into bootloader mode and then booted a custom recovery (TWRP) so it could run a Nandroid backup. It did and ended up with a 2.30 GB backup located at /sdcard/TWRP/BACKUPS/SerialNumberOfYourPhone/. From what I can tell the NRT automates what you can do manually, only when it finished the process and attempted to copy the backup to the PC it only grabbed about 40 MB worth and reported a successful backup.

    Since I had been watching the process from the phone I saw that it reported the size of the data it was backing up as 2750 MB, so I knew that the NRT was wrong. It asked if I wanted to nuke the backup since it copied it over, and I told it No since I knew it was wrong.


    1 members found this post helpful.

  4. #4
    root
    Join Date
    May 2011
    Posts
    506

    Device(s)
    Nexus 6P, HTC One M9
    Thanks for the updates, please keep them coming. I've seen adb backup hang on phones that aren't rooted, although -nosystem should alleviate that.

    --jeremy



  5. #5
    Member
    Join Date
    Jan 2014
    Posts
    5

    Original Poster
    Quote Originally Posted by jeremy View Post
    I've seen adb backup hang on phones that aren't rooted, although -nosystem should alleviate that.
    Based on what I read I would have thought so too, but no matter, I bit the bullet and unlocked the phone. I was able to use TWRP to make a full backup of stock Android 4.4.2 on my Nexus 4 and then again once I had rooted it and got it setup like I wanted it. What I thought was particularly impressive was how it was able to store the backup on the same volume that it was pulling the original data from.


    ---

    Continuing with my notes ...

    * If I haven't mentioned it yet, I used Windows 7x64 for all steps.

    ---

    I followed the directions on this page and didn't have any problems. Well, the one problem I did have was not freaking out when my Nexus wasn't seen by either
    Code:
    adb devices
    or
    Code:
    fastboot devices
    .

    I frequently made the mistake when experimenting on my own by using one or the other when it wasn't appropriate. I ended up learning that fastboot is used when interacting with the bootloader and adb is used when the phone is booted into the full Android OS or in Recovery mode.

    After I had TWRP installed, the Android 4.4.2 installation rooted (again using this set of instructions) and my phone setup the way I wanted it, I took a final Nandroid backup using TWRP and then booted the phone back into the full OS.

    I proceeded to copy the /sdcard/TWRP backup files to the PC as a precaution. I ended up using the official factory images for the Nexus 4 to flash Android 4.2.2 all the way up to Android 4.4.2 "just to do it". Restoring my TWRP backup first required me to re-flash TWRP and then copy the TWRP backup folder back to /sdcard/TWRP. I booted back into Recovery mode via adb reboot recovery and used the menu system to drill down to the backup I was interested in and restore it. I then rebooted when prompted and my phone was restored to where I last made a Nandroid backup.

    I took extensive pictures using a second phone and kept all output so I could have something to refer to if (uhm, when) I try this again in the future.

    What I learned at the end is that I could have flashed just the OS by modifying the flash-all.bat file to remove the -w switch from the final fastboot command in the file. Here is what it looks like by default for the file included in the Android 4.2.2 factory image tarball:

    Code:
    fastboot -w update image-occam-jdq39.zip
    and after removing the switch:

    Code:
    fastboot update image-occam-jdq39.zip
    Using that approach I would likely be able to safely keep the /sdcard/TWRP files on the phone during the flashing of stock roms. I hope this helps someone. Unfortunately I never did find a way to use adb to make a successful backup prior to unlocking the bootloader, so if I had it to do all over again I would have unlocked the bootloader when I first received it. Lesson learned!


    1 members found this post helpful.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •