• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Backup and Restore without Root (Galaxy Nexus and Mac)

Hipe0ples555

Member
Dec 20, 2011
53
13
UPDATED 2/3/12

Thanks to @copkay for writing this! [GUIDE] Full Phone Backup without Unlock or Root - xda-developers (windows version)

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.

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.

u0AlP.png


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.

XWPlZ.png


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.

nVx4N.png



The command parameters format is:

./adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|nosystem] [<packages...>]

The most basic command you can use is simply:

./adb backup -all

This will use the defaults to backup only app and device data (not the APKs themselves) to the current directory as 'backup.ab'

iGFNm.png


To explain the parameters:

./adb backup -f <file>

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

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

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

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

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...>

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.

4. You will see a screen like the following:

OGmMa.png


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

replacing '/backup/mybackup.ab' with the location of your backup file.

10. You will see a screen like the one below:

MT9Sl.png


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
 
hey thanks a lot for this buddy - unfortunately I cannot get my Gnex to show up in the list of devices. I use adb often enough to have a PATH variable for it in my bash_profile so - while I'm no UNIX ninja, I do know more or less what I'm doing.

anyway - I can't seem to get the phone recognized by adb... using latest SDK Tools version (16 I believe?).

what am I missing?

-----------

update - hold on... I just realized my install of the latest SDK tools wasn't quite finished - it got hung up waiting for a password for some stupid Motorola plug in - I'm finishing up the d/l now and hopefully will have the up-to-date SDK tools after, which I hope will fix the problem.

-----------

2nd UPDATE - not working. all SDK's updated and current. still nothing shows up under list of devices...

assistance?
 
Upvote 0
hey thanks a lot for this buddy - unfortunately I cannot get my Gnex to show up in the list of devices. I use adb often enough to have a PATH variable for it in my bash_profile so - while I'm no UNIX ninja, I do know more or less what I'm doing.

anyway - I can't seem to get the phone recognized by adb... using latest SDK Tools version (16 I believe?).

what am I missing?

-----------

update - hold on... I just realized my install of the latest SDK tools wasn't quite finished - it got hung up waiting for a password for some stupid Motorola plug in - I'm finishing up the d/l now and hopefully will have the up-to-date SDK tools after, which I hope will fix the problem.

-----------

2nd UPDATE - not working. all SDK's updated and current. still nothing shows up under list of devices...

assistance?

Did you do the first "cd " and drag the platform tools command, and if you did, next, id no error occur, type"./adb" and hit enter! And make sure usb debugging is on but it probably is.
 
Upvote 0
So I was able to restore, unlock the bootloader and root successfully following this and various other guide. I'm now in the process of attempting to restore my back up, which is located in:

/android-sdks/platform-tools/backup.ab

When I attempt to type the following in the terminal:

./adb restore backup.ab

I get a message that says "unable to connect for backup"

If I attempt to type in the following as stated in the guide:

./adb restore /backup/backup.ab

I get a message that says "unable to open file /backup.ab"


...HALP?

EDIT: I just ran ./adb devices in terminal and nothing was listed which leads me to believe this is the source of my problem. How can I address this? I noticed that earlier when I had the phone plugged in through a USB hub, the device was not listed. I then plugged the device directly into my laptop and it was listed when I ran ./adb devices
 
Upvote 0
So I was able to restore, unlock the bootloader and root successfully following this and various other guide. I'm now in the process of attempting to restore my back up, which is located in:

/android-sdks/platform-tools/backup.ab

When I attempt to type the following in the terminal:

./adb restore backup.ab

I get a message that says "unable to connect for backup"

If I attempt to type in the following as stated in the guide:

./adb restore /backup/backup.ab

I get a message that says "unable to open file /backup.ab"


...HALP?

EDIT: I just ran ./adb devices in terminal and nothing was listed which leads me to believe this is the source of my problem. How can I address this? I noticed that earlier when I had the phone plugged in through a USB hub, the device was not listed. I then plugged the device directly into my laptop and it was listed when I ran ./adb devices

./adb restore /android-sdks/platform-tools/backup.ab

OR adb devices

and do

./adb -s ######### restore..... etc.

where ############### is your device id.

edit: saw your edit... you need to be able to connect first... usb debugging, etc?
 
  • Like
Reactions: xavious85
Upvote 0
one quick question, does this backup the Internal memory also? AKA SD

No, even though it says "all" it really doesn't work... use:

adb -s 00000000000000 pull /sdcard/ D:\android\nexus\backup

the `-s [device id#]` part is optional. Also read the last lines of the backup when done, if it doesn't mention the number of files, it didn't complete successfully.
 
Upvote 0
will gie it a try right now

No, even though it says "all" it really doesn't work... use:

adb -s 00000000000000 pull /sdcard/ D:\android\nexus\backup

the `-s [device id#]` part is optional. Also read the last lines of the backup when done, if it doesn't mention the number of files, it didn't complete successfully.

worked, thanks


667 files pulled. 0 files skipped.
1059 KB/s (87865555 bytes in 80.987s)
 
Upvote 0
worked, thanks


667 files pulled. 0 files skipped.
1059 KB/s (87865555 bytes in 80.987s)

Outstanding!

I actually stumbled upon that method after trying many ways of "one click" sd card backup. I could never just select everything and drag to a windows folder, always got errors and the copy aborted. Sync tools used drive letters for every one that I could find.

Now I have a script that I run to do the ab backup and my sd in one shot. Works like a charm!
 
Upvote 0
Outstanding!

I actually stumbled upon that method after trying many ways of "one click" sd card backup. I could never just select everything and drag to a windows folder, always got errors and the copy aborted. Sync tools used drive letters for every one that I could find.

Now I have a script that I run to do the ab backup and my sd in one shot. Works like a charm!
yeah and i was having issues to. but im good now
 
Upvote 0
hello guys!
thanks for wonderful guide

i tried with my rooted nexus (i think it works also with a rooted one)
if i use ./adb backup -all it works perfectly..it ask me password and go on...
if i use ./adb backup -apk nothing happens...Nexus doesn't ask me password
adb only create a zerobyte backup.ab file but no more actions...do you know why?

thanks
regards
 
Upvote 0
i tried
but it backup only shared and system data

i tried with -apk -shared -all and it create a file of 229MB
i tried with -share -all and it create a file like the first (same checksum)
i tried with only -apk and it create a zerobyte file....

could it be becouse i've a rooted device?
thanks
regards

Simon
 
Upvote 0
hi guys

first question : after a full backup of shared, all and apk is it possible to restore only a particular apk?


second question : i've restored my entire backup
all done...but:
my personal directories or third-part program dirs wasn't backupped, like /sdcard/Camscanner or /sdcard/media
is it possible to bakcup all my personal dirs and then restore also them with adb bakcup/restore commands?

thanks
regards
 
Upvote 0
i've tried to backup several times now, but each time, the backup stops at random places. the first time at about 300mb, then 400mb, and then 600mb. i did the -apk backup and i know that i should be getting several GB worth. any ideas?

This happened to me too, accept I don't think with the apk but it should be the same. All I did was unplugged the phone, quit terminal, made sure the Android SDK was all updated and re-tried! Hope it works!!
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones