60

I am soon going to unlock bootloader and root my Nexus 5, but I didn't wanted to wipe all the data so I thought of using the ADB backup function to restore after rooting is done.

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

So, I made a full backup, with apk, with shared, all.

First of all, what all does this command backup? I suppose everything. Does it include the system, that is, Android files, like the main ROM files including kernel and stuff? Will the ROM get restored after I restore this backup?

Also, after I have rooted the device (which I have still not done), will I be able to restore just the apps, app data and shared storage from the backup? Or should I just backup the apk with shared data backup and that will do it?

Is it possible with a third-party app, root/non-root? (Titanium Backup, maybe?)

I need to know more.

Akshat Mittal
  • 725
  • 1
  • 7
  • 8

1 Answers1

46

For what ADB backup does, you might wish to see our tag-wiki. Basically, depending on the command line switches used, it backs up apps (.apk) and their data. For a full list of options see this.

As for the second part of your question, you might wish to see Is there a way to look inside and modify an adb backup created file? Yes, it's possible extracting parts of it, and yes, Titanium Backup is one of the apps capable of this. Other ways are described in the linked question.

Also worth a look:

TAAPSogeking
  • 183
  • 2
  • 10
Izzy
  • 91,166
  • 73
  • 343
  • 943
  • 6
    It's worth noting some apk's will not backup via adb. (the intent is to keep people from stealing apps.) – Ricky Mar 07 '15 at 05:23
  • 3
    @RickyBeam is right. Devs can set the ALLOW_BACKUP flag to "No"; I've encountered a couple of such apps. Don't know whether "theft protection" is all behind that, as there were also some open-source apps amongst those. – Izzy Mar 07 '15 at 14:25
  • @RickyBeam PS: If you want to backup those apps as well, on a rooted device with Xposed Framework installed Backup All Apps disables that "lock" :) – Izzy Jun 09 '15 at 17:58
  • 4
    Ouch. Another restriction: it doesn't seem to cover SMS/MMS (see: Backup/Restore SMS/MMS via ADB on a non-rooted device?). – Izzy Jul 07 '15 at 09:45
  • For readers: Well for backing up SMS(no MMS backup) we can use app like Super Backup : SMS & Contacts. – Lucky Jul 07 '15 at 09:50
  • @Lucky In most cases, yes. In some cases, no (see the linked question). Apart from that, using something else than adb backup is a different topic :) – Izzy Jul 07 '15 at 09:51
  • 2
    does adb backup save the sqlite databases? – tisaconundrum Jun 14 '18 at 21:37
  • 1
    If the app-in-question permits, yes. Concerning apps, it archives the APK (when run with -apk), the app's data directory (/data/data/<package_name>) and some more "little pieces". – Izzy Jun 15 '18 at 07:00
  • adb backup is now deprecated, no longer documented and may be removed from a future release. Google is gradually stripping the user from ownership over their phone and its data. It's soon Windows. – Nilzor Apr 10 '23 at 08:29
  • @Nilzor too true unfortunately. Starting with Android 12 I've read it only backs up the APK but not the data – except if the application is compiled for debug. Which is pretty stupid. I understand they want to protect our data – but why from us? Backing up to Google's servers will still be permitted (uses the same back-end as adb backup: bmgr). I just hope no custom ROM will not honor that change… – Izzy Apr 14 '23 at 18:58